Text Compare
Produced: 7/19/2015 1:51:42 PM
   
Mode:  All, With Context  
Left file: C:\mksong\workspace_genproglase\genproglase-output-r1658\template08\0718-1345\valgrind-bug-11625-11627\sanity\helgrind\hg_main.c  
Right file: C:\mksong\workspace_genproglase\genproglase-output-r1658\template08\0718-1345\valgrind-bug-11625-11627\000000\helgrind\hg_main.c  
1 typedef unsigned char UChar; = 1 typedef unsigned char UChar;
2 typedef signed char Char;   2 typedef signed char Char;
3 typedef char HChar;   3 typedef char HChar;
4 typedef unsigned short UShort;   4 typedef unsigned short UShort;
5 typedef short Short;   5 typedef short Short;
6 typedef unsigned int UInt;   6 typedef unsigned int UInt;
7 typedef int Int;   7 typedef int Int;
8 typedef unsigned long long ULong;   8 typedef unsigned long long ULong;
9 typedef long long Long;   9 typedef long long Long;
10 typedef UInt U128[4];   10 typedef UInt U128[4];
11 union __anonunion_V128_1 {   11 union __anonunion_V128_1 {
12    UChar w8[16] ;   12    UChar w8[16] ;
13    UShort w16[8] ;   13    UShort w16[8] ;
14    UInt w32[4] ;   14    UInt w32[4] ;
15    ULong w64[2] ;   15    ULong w64[2] ;
16 };   16 };
17 typedef union __anonunion_V128_1 V128;   17 typedef union __anonunion_V128_1 V128;
18 typedef float Float;   18 typedef float Float;
19 typedef double Double;   19 typedef double Double;
20 typedef unsigned char Bool;   20 typedef unsigned char Bool;
21 typedef UInt Addr32;   21 typedef UInt Addr32;
22 typedef ULong Addr64;   22 typedef ULong Addr64;
23 typedef unsigned long HWord;   23 typedef unsigned long HWord;
24 typedef __builtin_va_list __gnuc_va_list;   24 typedef __builtin_va_list __gnuc_va_list;
25 typedef __gnuc_va_list va_list;   25 typedef __gnuc_va_list va_list;
26 typedef unsigned long UWord;   26 typedef unsigned long UWord;
27 typedef long Word;   27 typedef long Word;
28 typedef UWord Addr;   28 typedef UWord Addr;
29 typedef UWord AddrH;   29 typedef UWord AddrH;
30 typedef UWord SizeT;   30 typedef UWord SizeT;
31 typedef Word SSizeT;   31 typedef Word SSizeT;
32 typedef Word PtrdiffT;   32 typedef Word PtrdiffT;
33 typedef Word OffT;   33 typedef Word OffT;
34 typedef Long Off64T;   34 typedef Long Off64T;
35 struct __anonstruct_UWordPair_2 {   35 struct __anonstruct_UWordPair_2 {
36    UWord uw1 ;   36    UWord uw1 ;
37    UWord uw2 ;   37    UWord uw2 ;
38 };   38 };
39 typedef struct __anonstruct_UWordPair_2 UWordPair;   39 typedef struct __anonstruct_UWordPair_2 UWordPair;
40 typedef UInt ThreadId;   40 typedef UInt ThreadId;
41 struct __anonstruct_SysRes_3 {   41 struct __anonstruct_SysRes_3 {
42    UWord _val ;   42    UWord _val ;
43    Bool _isError ;   43    Bool _isError ;
44 };   44 };
45 typedef struct __anonstruct_SysRes_3 SysRes;   45 typedef struct __anonstruct_SysRes_3 SysRes;
46 enum __anonenum_VgMsgKind_4 {   46 enum __anonenum_VgMsgKind_4 {
47     Vg_FailMsg = 0,   47     Vg_FailMsg = 0,
48     Vg_UserMsg = 1,   48     Vg_UserMsg = 1,
49     Vg_DebugMsg = 2,   49     Vg_DebugMsg = 2,
50     Vg_ClientMsg = 3   50     Vg_ClientMsg = 3
51 } ;   51 } ;
52 typedef enum __anonenum_VgMsgKind_4 VgMsgKind;   52 typedef enum __anonenum_VgMsgKind_4 VgMsgKind;
53 struct _ExeContext;   53 struct _ExeContext;
54 typedef struct _ExeContext ExeContext;   54 typedef struct _ExeContext ExeContext;
55 enum __anonenum_VgRes_5 {   55 enum __anonenum_VgRes_5 {
56     Vg_LowRes = 0,   56     Vg_LowRes = 0,
57     Vg_MedRes = 1,   57     Vg_MedRes = 1,
58     Vg_HighRes = 2   58     Vg_HighRes = 2
59 } ;   59 } ;
60 typedef enum __anonenum_VgRes_5 VgRes;   60 typedef enum __anonenum_VgRes_5 VgRes;
61 typedef Int ErrorKind;   61 typedef Int ErrorKind;
62 struct _Error;   62 struct _Error;
63 typedef struct _Error Error;   63 typedef struct _Error Error;
64 typedef Int SuppKind;   64 typedef Int SuppKind;
65 struct _Supp;   65 struct _Supp;
66 typedef struct _Supp Supp;   66 typedef struct _Supp Supp;
67 enum __anonenum_IRType_6 {   67 enum __anonenum_IRType_6 {
68     Ity_INVALID = 69632,   68     Ity_INVALID = 69632,
69     Ity_I1 = 69633,   69     Ity_I1 = 69633,
70     Ity_I8 = 69634,   70     Ity_I8 = 69634,
71     Ity_I16 = 69635,   71     Ity_I16 = 69635,
72     Ity_I32 = 69636,   72     Ity_I32 = 69636,
73     Ity_I64 = 69637,   73     Ity_I64 = 69637,
74     Ity_I128 = 69638,   74     Ity_I128 = 69638,
75     Ity_F32 = 69639,   75     Ity_F32 = 69639,
76     Ity_F64 = 69640,   76     Ity_F64 = 69640,
77     Ity_F128 = 69641,   77     Ity_F128 = 69641,
78     Ity_V128 = 69642   78     Ity_V128 = 69642
79 } ;   79 } ;
80 typedef enum __anonenum_IRType_6 IRType;   80 typedef enum __anonenum_IRType_6 IRType;
81 enum __anonenum_IREndness_7 {   81 enum __anonenum_IREndness_7 {
82     Iend_LE = 73728,   82     Iend_LE = 73728,
83     Iend_BE = 73729   83     Iend_BE = 73729
84 } ;   84 } ;
85 typedef enum __anonenum_IREndness_7 IREndness;   85 typedef enum __anonenum_IREndness_7 IREndness;
86 enum __anonenum_IRConstTag_8 {   86 enum __anonenum_IRConstTag_8 {
87     Ico_U1 = 77824,   87     Ico_U1 = 77824,
88     Ico_U8 = 77825,   88     Ico_U8 = 77825,
89     Ico_U16 = 77826,   89     Ico_U16 = 77826,
90     Ico_U32 = 77827,   90     Ico_U32 = 77827,
91     Ico_U64 = 77828,   91     Ico_U64 = 77828,
92     Ico_F32 = 77829,   92     Ico_F32 = 77829,
93     Ico_F32i = 77830,   93     Ico_F32i = 77830,
94     Ico_F64 = 77831,   94     Ico_F64 = 77831,
95     Ico_F64i = 77832,   95     Ico_F64i = 77832,
96     Ico_V128 = 77833   96     Ico_V128 = 77833
97 } ;   97 } ;
98 typedef enum __anonenum_IRConstTag_8 IRConstTag;   98 typedef enum __anonenum_IRConstTag_8 IRConstTag;
99 union __anonunion_Ico_9 {   99 union __anonunion_Ico_9 {
100    Bool U1 ;   100    Bool U1 ;
101    UChar U8 ;   101    UChar U8 ;
102    UShort U16 ;   102    UShort U16 ;
103    UInt U32 ;   103    UInt U32 ;
104    ULong U64 ;   104    ULong U64 ;
105    Float F32 ;   105    Float F32 ;
106    UInt F32i ;   106    UInt F32i ;
107    Double F64 ;   107    Double F64 ;
108    ULong F64i ;   108    ULong F64i ;
109    UShort V128 ;   109    UShort V128 ;
110 };   110 };
111 struct _IRConst {   111 struct _IRConst {
112    IRConstTag tag ;   112    IRConstTag tag ;
113    union __anonunion_Ico_9 Ico ;   113    union __anonunion_Ico_9 Ico ;
114 };   114 };
115 typedef struct _IRConst IRConst;   115 typedef struct _IRConst IRConst;
116 struct __anonstruct_IRCallee_10 {   116 struct __anonstruct_IRCallee_10 {
117    Int regparms ;   117    Int regparms ;
118    HChar *name ;   118    HChar *name ;
119    void *addr ;   119    void *addr ;
120    UInt mcx_mask ;   120    UInt mcx_mask ;
121 };   121 };
122 typedef struct __anonstruct_IRCallee_10 IRCallee;   122 typedef struct __anonstruct_IRCallee_10 IRCallee;
123 struct __anonstruct_IRRegArray_11 {   123 struct __anonstruct_IRRegArray_11 {
124    Int base ;   124    Int base ;
125    IRType elemTy ;   125    IRType elemTy ;
126    Int nElems ;   126    Int nElems ;
127 };   127 };
128 typedef struct __anonstruct_IRRegArray_11 IRRegArray;   128 typedef struct __anonstruct_IRRegArray_11 IRRegArray;
129 typedef UInt IRTemp;   129 typedef UInt IRTemp;
130 enum __anonenum_IROp_12 {   130 enum __anonenum_IROp_12 {
131     Iop_INVALID = 81920,   131     Iop_INVALID = 81920,
132     Iop_Add8 = 81921,   132     Iop_Add8 = 81921,
133     Iop_Add16 = 81922,   133     Iop_Add16 = 81922,
134     Iop_Add32 = 81923,   134     Iop_Add32 = 81923,
135     Iop_Add64 = 81924,   135     Iop_Add64 = 81924,
136     Iop_Sub8 = 81925,   136     Iop_Sub8 = 81925,
137     Iop_Sub16 = 81926,   137     Iop_Sub16 = 81926,
138     Iop_Sub32 = 81927,   138     Iop_Sub32 = 81927,
139     Iop_Sub64 = 81928,   139     Iop_Sub64 = 81928,
140     Iop_Mul8 = 81929,   140     Iop_Mul8 = 81929,
141     Iop_Mul16 = 81930,   141     Iop_Mul16 = 81930,
142     Iop_Mul32 = 81931,   142     Iop_Mul32 = 81931,
143     Iop_Mul64 = 81932,   143     Iop_Mul64 = 81932,
144     Iop_Or8 = 81933,   144     Iop_Or8 = 81933,
145     Iop_Or16 = 81934,   145     Iop_Or16 = 81934,
146     Iop_Or32 = 81935,   146     Iop_Or32 = 81935,
147     Iop_Or64 = 81936,   147     Iop_Or64 = 81936,
148     Iop_And8 = 81937,   148     Iop_And8 = 81937,
149     Iop_And16 = 81938,   149     Iop_And16 = 81938,
150     Iop_And32 = 81939,   150     Iop_And32 = 81939,
151     Iop_And64 = 81940,   151     Iop_And64 = 81940,
152     Iop_Xor8 = 81941,   152     Iop_Xor8 = 81941,
153     Iop_Xor16 = 81942,   153     Iop_Xor16 = 81942,
154     Iop_Xor32 = 81943,   154     Iop_Xor32 = 81943,
155     Iop_Xor64 = 81944,   155     Iop_Xor64 = 81944,
156     Iop_Shl8 = 81945,   156     Iop_Shl8 = 81945,
157     Iop_Shl16 = 81946,   157     Iop_Shl16 = 81946,
158     Iop_Shl32 = 81947,   158     Iop_Shl32 = 81947,
159     Iop_Shl64 = 81948,   159     Iop_Shl64 = 81948,
160     Iop_Shr8 = 81949,   160     Iop_Shr8 = 81949,
161     Iop_Shr16 = 81950,   161     Iop_Shr16 = 81950,
162     Iop_Shr32 = 81951,   162     Iop_Shr32 = 81951,
163     Iop_Shr64 = 81952,   163     Iop_Shr64 = 81952,
164     Iop_Sar8 = 81953,   164     Iop_Sar8 = 81953,
165     Iop_Sar16 = 81954,   165     Iop_Sar16 = 81954,
166     Iop_Sar32 = 81955,   166     Iop_Sar32 = 81955,
167     Iop_Sar64 = 81956,   167     Iop_Sar64 = 81956,
168     Iop_CmpEQ8 = 81957,   168     Iop_CmpEQ8 = 81957,
169     Iop_CmpEQ16 = 81958,   169     Iop_CmpEQ16 = 81958,
170     Iop_CmpEQ32 = 81959,   170     Iop_CmpEQ32 = 81959,
171     Iop_CmpEQ64 = 81960,   171     Iop_CmpEQ64 = 81960,
172     Iop_CmpNE8 = 81961,   172     Iop_CmpNE8 = 81961,
173     Iop_CmpNE16 = 81962,   173     Iop_CmpNE16 = 81962,
174     Iop_CmpNE32 = 81963,   174     Iop_CmpNE32 = 81963,
175     Iop_CmpNE64 = 81964,   175     Iop_CmpNE64 = 81964,
176     Iop_Not8 = 81965,   176     Iop_Not8 = 81965,
177     Iop_Not16 = 81966,   177     Iop_Not16 = 81966,
178     Iop_Not32 = 81967,   178     Iop_Not32 = 81967,
179     Iop_Not64 = 81968,   179     Iop_Not64 = 81968,
180     Iop_CasCmpEQ8 = 81969,   180     Iop_CasCmpEQ8 = 81969,
181     Iop_CasCmpEQ16 = 81970,   181     Iop_CasCmpEQ16 = 81970,
182     Iop_CasCmpEQ32 = 81971,   182     Iop_CasCmpEQ32 = 81971,
183     Iop_CasCmpEQ64 = 81972,   183     Iop_CasCmpEQ64 = 81972,
184     Iop_CasCmpNE8 = 81973,   184     Iop_CasCmpNE8 = 81973,
185     Iop_CasCmpNE16 = 81974,   185     Iop_CasCmpNE16 = 81974,
186     Iop_CasCmpNE32 = 81975,   186     Iop_CasCmpNE32 = 81975,
187     Iop_CasCmpNE64 = 81976,   187     Iop_CasCmpNE64 = 81976,
188     Iop_MullS8 = 81977,   188     Iop_MullS8 = 81977,
189     Iop_MullS16 = 81978,   189     Iop_MullS16 = 81978,
190     Iop_MullS32 = 81979,   190     Iop_MullS32 = 81979,
191     Iop_MullS64 = 81980,   191     Iop_MullS64 = 81980,
192     Iop_MullU8 = 81981,   192     Iop_MullU8 = 81981,
193     Iop_MullU16 = 81982,   193     Iop_MullU16 = 81982,
194     Iop_MullU32 = 81983,   194     Iop_MullU32 = 81983,
195     Iop_MullU64 = 81984,   195     Iop_MullU64 = 81984,
196     Iop_Clz64 = 81985,   196     Iop_Clz64 = 81985,
197     Iop_Clz32 = 81986,   197     Iop_Clz32 = 81986,
198     Iop_Ctz64 = 81987,   198     Iop_Ctz64 = 81987,
199     Iop_Ctz32 = 81988,   199     Iop_Ctz32 = 81988,
200     Iop_CmpLT32S = 81989,   200     Iop_CmpLT32S = 81989,
201     Iop_CmpLT64S = 81990,   201     Iop_CmpLT64S = 81990,
202     Iop_CmpLE32S = 81991,   202     Iop_CmpLE32S = 81991,
203     Iop_CmpLE64S = 81992,   203     Iop_CmpLE64S = 81992,
204     Iop_CmpLT32U = 81993,   204     Iop_CmpLT32U = 81993,
205     Iop_CmpLT64U = 81994,   205     Iop_CmpLT64U = 81994,
206     Iop_CmpLE32U = 81995,   206     Iop_CmpLE32U = 81995,
207     Iop_CmpLE64U = 81996,   207     Iop_CmpLE64U = 81996,
208     Iop_CmpNEZ8 = 81997,   208     Iop_CmpNEZ8 = 81997,
209     Iop_CmpNEZ16 = 81998,   209     Iop_CmpNEZ16 = 81998,
210     Iop_CmpNEZ32 = 81999,   210     Iop_CmpNEZ32 = 81999,
211     Iop_CmpNEZ64 = 82000,   211     Iop_CmpNEZ64 = 82000,
212     Iop_CmpwNEZ32 = 82001,   212     Iop_CmpwNEZ32 = 82001,
213     Iop_CmpwNEZ64 = 82002,   213     Iop_CmpwNEZ64 = 82002,
214     Iop_Left8 = 82003,   214     Iop_Left8 = 82003,
215     Iop_Left16 = 82004,   215     Iop_Left16 = 82004,
216     Iop_Left32 = 82005,   216     Iop_Left32 = 82005,
217     Iop_Left64 = 82006,   217     Iop_Left64 = 82006,
218     Iop_Max32U = 82007,   218     Iop_Max32U = 82007,
219     Iop_CmpORD32U = 82008,   219     Iop_CmpORD32U = 82008,
220     Iop_CmpORD64U = 82009,   220     Iop_CmpORD64U = 82009,
221     Iop_CmpORD32S = 82010,   221     Iop_CmpORD32S = 82010,
222     Iop_CmpORD64S = 82011,   222     Iop_CmpORD64S = 82011,
223     Iop_DivU32 = 82012,   223     Iop_DivU32 = 82012,
224     Iop_DivS32 = 82013,   224     Iop_DivS32 = 82013,
225     Iop_DivU64 = 82014,   225     Iop_DivU64 = 82014,
226     Iop_DivS64 = 82015,   226     Iop_DivS64 = 82015,
227     Iop_DivModU64to32 = 82016,   227     Iop_DivModU64to32 = 82016,
228     Iop_DivModS64to32 = 82017,   228     Iop_DivModS64to32 = 82017,
229     Iop_DivModU128to64 = 82018,   229     Iop_DivModU128to64 = 82018,
230     Iop_DivModS128to64 = 82019,   230     Iop_DivModS128to64 = 82019,
231     Iop_DivModS64to64 = 82020,   231     Iop_DivModS64to64 = 82020,
232     Iop_8Uto16 = 82021,   232     Iop_8Uto16 = 82021,
233     Iop_8Uto32 = 82022,   233     Iop_8Uto32 = 82022,
234     Iop_8Uto64 = 82023,   234     Iop_8Uto64 = 82023,
235     Iop_16Uto32 = 82024,   235     Iop_16Uto32 = 82024,
236     Iop_16Uto64 = 82025,   236     Iop_16Uto64 = 82025,
237     Iop_32Uto64 = 82026,   237     Iop_32Uto64 = 82026,
238     Iop_8Sto16 = 82027,   238     Iop_8Sto16 = 82027,
239     Iop_8Sto32 = 82028,   239     Iop_8Sto32 = 82028,
240     Iop_8Sto64 = 82029,   240     Iop_8Sto64 = 82029,
241     Iop_16Sto32 = 82030,   241     Iop_16Sto32 = 82030,
242     Iop_16Sto64 = 82031,   242     Iop_16Sto64 = 82031,
243     Iop_32Sto64 = 82032,   243     Iop_32Sto64 = 82032,
244     Iop_64to8 = 82033,   244     Iop_64to8 = 82033,
245     Iop_32to8 = 82034,   245     Iop_32to8 = 82034,
246     Iop_64to16 = 82035,   246     Iop_64to16 = 82035,
247     Iop_16to8 = 82036,   247     Iop_16to8 = 82036,
248     Iop_16HIto8 = 82037,   248     Iop_16HIto8 = 82037,
249     Iop_8HLto16 = 82038,   249     Iop_8HLto16 = 82038,
250     Iop_32to16 = 82039,   250     Iop_32to16 = 82039,
251     Iop_32HIto16 = 82040,   251     Iop_32HIto16 = 82040,
252     Iop_16HLto32 = 82041,   252     Iop_16HLto32 = 82041,
253     Iop_64to32 = 82042,   253     Iop_64to32 = 82042,
254     Iop_64HIto32 = 82043,   254     Iop_64HIto32 = 82043,
255     Iop_32HLto64 = 82044,   255     Iop_32HLto64 = 82044,
256     Iop_128to64 = 82045,   256     Iop_128to64 = 82045,
257     Iop_128HIto64 = 82046,   257     Iop_128HIto64 = 82046,
258     Iop_64HLto128 = 82047,   258     Iop_64HLto128 = 82047,
259     Iop_Not1 = 82048,   259     Iop_Not1 = 82048,
260     Iop_32to1 = 82049,   260     Iop_32to1 = 82049,
261     Iop_64to1 = 82050,   261     Iop_64to1 = 82050,
262     Iop_1Uto8 = 82051,   262     Iop_1Uto8 = 82051,
263     Iop_1Uto32 = 82052,   263     Iop_1Uto32 = 82052,
264     Iop_1Uto64 = 82053,   264     Iop_1Uto64 = 82053,
265     Iop_1Sto8 = 82054,   265     Iop_1Sto8 = 82054,
266     Iop_1Sto16 = 82055,   266     Iop_1Sto16 = 82055,
267     Iop_1Sto32 = 82056,   267     Iop_1Sto32 = 82056,
268     Iop_1Sto64 = 82057,   268     Iop_1Sto64 = 82057,
269     Iop_AddF64 = 82058,   269     Iop_AddF64 = 82058,
270     Iop_SubF64 = 82059,   270     Iop_SubF64 = 82059,
271     Iop_MulF64 = 82060,   271     Iop_MulF64 = 82060,
272     Iop_DivF64 = 82061,   272     Iop_DivF64 = 82061,
273     Iop_AddF32 = 82062,   273     Iop_AddF32 = 82062,
274     Iop_SubF32 = 82063,   274     Iop_SubF32 = 82063,
275     Iop_MulF32 = 82064,   275     Iop_MulF32 = 82064,
276     Iop_DivF32 = 82065,   276     Iop_DivF32 = 82065,
277     Iop_AddF64r32 = 82066,   277     Iop_AddF64r32 = 82066,
278     Iop_SubF64r32 = 82067,   278     Iop_SubF64r32 = 82067,
279     Iop_MulF64r32 = 82068,   279     Iop_MulF64r32 = 82068,
280     Iop_DivF64r32 = 82069,   280     Iop_DivF64r32 = 82069,
281     Iop_NegF64 = 82070,   281     Iop_NegF64 = 82070,
282     Iop_AbsF64 = 82071,   282     Iop_AbsF64 = 82071,
283     Iop_NegF32 = 82072,   283     Iop_NegF32 = 82072,
284     Iop_AbsF32 = 82073,   284     Iop_AbsF32 = 82073,
285     Iop_SqrtF64 = 82074,   285     Iop_SqrtF64 = 82074,
286     Iop_SqrtF64r32 = 82075,   286     Iop_SqrtF64r32 = 82075,
287     Iop_SqrtF32 = 82076,   287     Iop_SqrtF32 = 82076,
288     Iop_CmpF64 = 82077,   288     Iop_CmpF64 = 82077,
289     Iop_CmpF32 = 82078,   289     Iop_CmpF32 = 82078,
290     Iop_CmpF128 = 82079,   290     Iop_CmpF128 = 82079,
291     Iop_F64toI16S = 82080,   291     Iop_F64toI16S = 82080,
292     Iop_F64toI32S = 82081,   292     Iop_F64toI32S = 82081,
293     Iop_F64toI64S = 82082,   293     Iop_F64toI64S = 82082,
294     Iop_F64toI32U = 82083,   294     Iop_F64toI32U = 82083,
295     Iop_I16StoF64 = 82084,   295     Iop_I16StoF64 = 82084,
296     Iop_I32StoF64 = 82085,   296     Iop_I32StoF64 = 82085,
297     Iop_I64StoF64 = 82086,   297     Iop_I64StoF64 = 82086,
298     Iop_I32UtoF64 = 82087,   298     Iop_I32UtoF64 = 82087,
299     Iop_F32toI16S = 82088,   299     Iop_F32toI16S = 82088,
300     Iop_F32toI32S = 82089,   300     Iop_F32toI32S = 82089,
301     Iop_F32toI64S = 82090,   301     Iop_F32toI64S = 82090,
302     Iop_I16StoF32 = 82091,   302     Iop_I16StoF32 = 82091,
303     Iop_I32StoF32 = 82092,   303     Iop_I32StoF32 = 82092,
304     Iop_I64StoF32 = 82093,   304     Iop_I64StoF32 = 82093,
305     Iop_F32toF64 = 82094,   305     Iop_F32toF64 = 82094,
306     Iop_F64toF32 = 82095,   306     Iop_F64toF32 = 82095,
307     Iop_ReinterpF64asI64 = 82096,   307     Iop_ReinterpF64asI64 = 82096,
308     Iop_ReinterpI64asF64 = 82097,   308     Iop_ReinterpI64asF64 = 82097,
309     Iop_ReinterpF32asI32 = 82098,   309     Iop_ReinterpF32asI32 = 82098,
310     Iop_ReinterpI32asF32 = 82099,   310     Iop_ReinterpI32asF32 = 82099,
311     Iop_F64HLtoF128 = 82100,   311     Iop_F64HLtoF128 = 82100,
312     Iop_F128HItoF64 = 82101,   312     Iop_F128HItoF64 = 82101,
313     Iop_F128LOtoF64 = 82102,   313     Iop_F128LOtoF64 = 82102,
314     Iop_AddF128 = 82103,   314     Iop_AddF128 = 82103,
315     Iop_SubF128 = 82104,   315     Iop_SubF128 = 82104,
316     Iop_MulF128 = 82105,   316     Iop_MulF128 = 82105,
317     Iop_DivF128 = 82106,   317     Iop_DivF128 = 82106,
318     Iop_NegF128 = 82107,   318     Iop_NegF128 = 82107,
319     Iop_AbsF128 = 82108,   319     Iop_AbsF128 = 82108,
320     Iop_SqrtF128 = 82109,   320     Iop_SqrtF128 = 82109,
321     Iop_I32StoF128 = 82110,   321     Iop_I32StoF128 = 82110,
322     Iop_I64StoF128 = 82111,   322     Iop_I64StoF128 = 82111,
323     Iop_F32toF128 = 82112,   323     Iop_F32toF128 = 82112,
324     Iop_F64toF128 = 82113,   324     Iop_F64toF128 = 82113,
325     Iop_F128toI32S = 82114,   325     Iop_F128toI32S = 82114,
326     Iop_F128toI64S = 82115,   326     Iop_F128toI64S = 82115,
327     Iop_F128toF64 = 82116,   327     Iop_F128toF64 = 82116,
328     Iop_F128toF32 = 82117,   328     Iop_F128toF32 = 82117,
329     Iop_AtanF64 = 82118,   329     Iop_AtanF64 = 82118,
330     Iop_Yl2xF64 = 82119,   330     Iop_Yl2xF64 = 82119,
331     Iop_Yl2xp1F64 = 82120,   331     Iop_Yl2xp1F64 = 82120,
332     Iop_PRemF64 = 82121,   332     Iop_PRemF64 = 82121,
333     Iop_PRemC3210F64 = 82122,   333     Iop_PRemC3210F64 = 82122,
334     Iop_PRem1F64 = 82123,   334     Iop_PRem1F64 = 82123,
335     Iop_PRem1C3210F64 = 82124,   335     Iop_PRem1C3210F64 = 82124,
336     Iop_ScaleF64 = 82125,   336     Iop_ScaleF64 = 82125,
337     Iop_SinF64 = 82126,   337     Iop_SinF64 = 82126,
338     Iop_CosF64 = 82127,   338     Iop_CosF64 = 82127,
339     Iop_TanF64 = 82128,   339     Iop_TanF64 = 82128,
340     Iop_2xm1F64 = 82129,   340     Iop_2xm1F64 = 82129,
341     Iop_RoundF64toInt = 82130,   341     Iop_RoundF64toInt = 82130,
342     Iop_RoundF32toInt = 82131,   342     Iop_RoundF32toInt = 82131,
343     Iop_MAddF32 = 82132,   343     Iop_MAddF32 = 82132,
344     Iop_MSubF32 = 82133,   344     Iop_MSubF32 = 82133,
345     Iop_MAddF64 = 82134,   345     Iop_MAddF64 = 82134,
346     Iop_MSubF64 = 82135,   346     Iop_MSubF64 = 82135,
347     Iop_MAddF64r32 = 82136,   347     Iop_MAddF64r32 = 82136,
348     Iop_MSubF64r32 = 82137,   348     Iop_MSubF64r32 = 82137,
349     Iop_Est5FRSqrt = 82138,   349     Iop_Est5FRSqrt = 82138,
350     Iop_RoundF64toF64_NEAREST = 82139,   350     Iop_RoundF64toF64_NEAREST = 82139,
351     Iop_RoundF64toF64_NegINF = 82140,   351     Iop_RoundF64toF64_NegINF = 82140,
352     Iop_RoundF64toF64_PosINF = 82141,   352     Iop_RoundF64toF64_PosINF = 82141,
353     Iop_RoundF64toF64_ZERO = 82142,   353     Iop_RoundF64toF64_ZERO = 82142,
354     Iop_TruncF64asF32 = 82143,   354     Iop_TruncF64asF32 = 82143,
355     Iop_RoundF64toF32 = 82144,   355     Iop_RoundF64toF32 = 82144,
356     Iop_CalcFPRF = 82145,   356     Iop_CalcFPRF = 82145,
357     Iop_Add16x2 = 82146,   357     Iop_Add16x2 = 82146,
358     Iop_Sub16x2 = 82147,   358     Iop_Sub16x2 = 82147,
359     Iop_QAdd16Sx2 = 82148,   359     Iop_QAdd16Sx2 = 82148,
360     Iop_QAdd16Ux2 = 82149,   360     Iop_QAdd16Ux2 = 82149,
361     Iop_QSub16Sx2 = 82150,   361     Iop_QSub16Sx2 = 82150,
362     Iop_QSub16Ux2 = 82151,   362     Iop_QSub16Ux2 = 82151,
363     Iop_HAdd16Ux2 = 82152,   363     Iop_HAdd16Ux2 = 82152,
364     Iop_HAdd16Sx2 = 82153,   364     Iop_HAdd16Sx2 = 82153,
365     Iop_HSub16Ux2 = 82154,   365     Iop_HSub16Ux2 = 82154,
366     Iop_HSub16Sx2 = 82155,   366     Iop_HSub16Sx2 = 82155,
367     Iop_Add8x4 = 82156,   367     Iop_Add8x4 = 82156,
368     Iop_Sub8x4 = 82157,   368     Iop_Sub8x4 = 82157,
369     Iop_QAdd8Sx4 = 82158,   369     Iop_QAdd8Sx4 = 82158,
370     Iop_QAdd8Ux4 = 82159,   370     Iop_QAdd8Ux4 = 82159,
371     Iop_QSub8Sx4 = 82160,   371     Iop_QSub8Sx4 = 82160,
372     Iop_QSub8Ux4 = 82161,   372     Iop_QSub8Ux4 = 82161,
373     Iop_HAdd8Ux4 = 82162,   373     Iop_HAdd8Ux4 = 82162,
374     Iop_HAdd8Sx4 = 82163,   374     Iop_HAdd8Sx4 = 82163,
375     Iop_HSub8Ux4 = 82164,   375     Iop_HSub8Ux4 = 82164,
376     Iop_HSub8Sx4 = 82165,   376     Iop_HSub8Sx4 = 82165,
377     Iop_Sad8Ux4 = 82166,   377     Iop_Sad8Ux4 = 82166,
378     Iop_CmpNEZ16x2 = 82167,   378     Iop_CmpNEZ16x2 = 82167,
379     Iop_CmpNEZ8x4 = 82168,   379     Iop_CmpNEZ8x4 = 82168,
380     Iop_I32UtoFx2 = 82169,   380     Iop_I32UtoFx2 = 82169,
381     Iop_I32StoFx2 = 82170,   381     Iop_I32StoFx2 = 82170,
382     Iop_FtoI32Ux2_RZ = 82171,   382     Iop_FtoI32Ux2_RZ = 82171,
383     Iop_FtoI32Sx2_RZ = 82172,   383     Iop_FtoI32Sx2_RZ = 82172,
384     Iop_F32ToFixed32Ux2_RZ = 82173,   384     Iop_F32ToFixed32Ux2_RZ = 82173,
385     Iop_F32ToFixed32Sx2_RZ = 82174,   385     Iop_F32ToFixed32Sx2_RZ = 82174,
386     Iop_Fixed32UToF32x2_RN = 82175,   386     Iop_Fixed32UToF32x2_RN = 82175,
387     Iop_Fixed32SToF32x2_RN = 82176,   387     Iop_Fixed32SToF32x2_RN = 82176,
388     Iop_Max32Fx2 = 82177,   388     Iop_Max32Fx2 = 82177,
389     Iop_Min32Fx2 = 82178,   389     Iop_Min32Fx2 = 82178,
390     Iop_PwMax32Fx2 = 82179,   390     Iop_PwMax32Fx2 = 82179,
391     Iop_PwMin32Fx2 = 82180,   391     Iop_PwMin32Fx2 = 82180,
392     Iop_CmpEQ32Fx2 = 82181,   392     Iop_CmpEQ32Fx2 = 82181,
393     Iop_CmpGT32Fx2 = 82182,   393     Iop_CmpGT32Fx2 = 82182,
394     Iop_CmpGE32Fx2 = 82183,   394     Iop_CmpGE32Fx2 = 82183,
395     Iop_Recip32Fx2 = 82184,   395     Iop_Recip32Fx2 = 82184,
396     Iop_Recps32Fx2 = 82185,   396     Iop_Recps32Fx2 = 82185,
397     Iop_Rsqrte32Fx2 = 82186,   397     Iop_Rsqrte32Fx2 = 82186,
398     Iop_Rsqrts32Fx2 = 82187,   398     Iop_Rsqrts32Fx2 = 82187,
399     Iop_Neg32Fx2 = 82188,   399     Iop_Neg32Fx2 = 82188,
400     Iop_Abs32Fx2 = 82189,   400     Iop_Abs32Fx2 = 82189,
401     Iop_CmpNEZ8x8 = 82190,   401     Iop_CmpNEZ8x8 = 82190,
402     Iop_CmpNEZ16x4 = 82191,   402     Iop_CmpNEZ16x4 = 82191,
403     Iop_CmpNEZ32x2 = 82192,   403     Iop_CmpNEZ32x2 = 82192,
404     Iop_Add8x8 = 82193,   404     Iop_Add8x8 = 82193,
405     Iop_Add16x4 = 82194,   405     Iop_Add16x4 = 82194,
406     Iop_Add32x2 = 82195,   406     Iop_Add32x2 = 82195,
407     Iop_QAdd8Ux8 = 82196,   407     Iop_QAdd8Ux8 = 82196,
408     Iop_QAdd16Ux4 = 82197,   408     Iop_QAdd16Ux4 = 82197,
409     Iop_QAdd32Ux2 = 82198,   409     Iop_QAdd32Ux2 = 82198,
410     Iop_QAdd64Ux1 = 82199,   410     Iop_QAdd64Ux1 = 82199,
411     Iop_QAdd8Sx8 = 82200,   411     Iop_QAdd8Sx8 = 82200,
412     Iop_QAdd16Sx4 = 82201,   412     Iop_QAdd16Sx4 = 82201,
413     Iop_QAdd32Sx2 = 82202,   413     Iop_QAdd32Sx2 = 82202,
414     Iop_QAdd64Sx1 = 82203,   414     Iop_QAdd64Sx1 = 82203,
415     Iop_PwAdd8x8 = 82204,   415     Iop_PwAdd8x8 = 82204,
416     Iop_PwAdd16x4 = 82205,   416     Iop_PwAdd16x4 = 82205,
417     Iop_PwAdd32x2 = 82206,   417     Iop_PwAdd32x2 = 82206,
418     Iop_PwMax8Sx8 = 82207,   418     Iop_PwMax8Sx8 = 82207,
419     Iop_PwMax16Sx4 = 82208,   419     Iop_PwMax16Sx4 = 82208,
420     Iop_PwMax32Sx2 = 82209,   420     Iop_PwMax32Sx2 = 82209,
421     Iop_PwMax8Ux8 = 82210,   421     Iop_PwMax8Ux8 = 82210,
422     Iop_PwMax16Ux4 = 82211,   422     Iop_PwMax16Ux4 = 82211,
423     Iop_PwMax32Ux2 = 82212,   423     Iop_PwMax32Ux2 = 82212,
424     Iop_PwMin8Sx8 = 82213,   424     Iop_PwMin8Sx8 = 82213,
425     Iop_PwMin16Sx4 = 82214,   425     Iop_PwMin16Sx4 = 82214,
426     Iop_PwMin32Sx2 = 82215,   426     Iop_PwMin32Sx2 = 82215,
427     Iop_PwMin8Ux8 = 82216,   427     Iop_PwMin8Ux8 = 82216,
428     Iop_PwMin16Ux4 = 82217,   428     Iop_PwMin16Ux4 = 82217,
429     Iop_PwMin32Ux2 = 82218,   429     Iop_PwMin32Ux2 = 82218,
430     Iop_PwAddL8Ux8 = 82219,   430     Iop_PwAddL8Ux8 = 82219,
431     Iop_PwAddL16Ux4 = 82220,   431     Iop_PwAddL16Ux4 = 82220,
432     Iop_PwAddL32Ux2 = 82221,   432     Iop_PwAddL32Ux2 = 82221,
433     Iop_PwAddL8Sx8 = 82222,   433     Iop_PwAddL8Sx8 = 82222,
434     Iop_PwAddL16Sx4 = 82223,   434     Iop_PwAddL16Sx4 = 82223,
435     Iop_PwAddL32Sx2 = 82224,   435     Iop_PwAddL32Sx2 = 82224,
436     Iop_Sub8x8 = 82225,   436     Iop_Sub8x8 = 82225,
437     Iop_Sub16x4 = 82226,   437     Iop_Sub16x4 = 82226,
438     Iop_Sub32x2 = 82227,   438     Iop_Sub32x2 = 82227,
439     Iop_QSub8Ux8 = 82228,   439     Iop_QSub8Ux8 = 82228,
440     Iop_QSub16Ux4 = 82229,   440     Iop_QSub16Ux4 = 82229,
441     Iop_QSub32Ux2 = 82230,   441     Iop_QSub32Ux2 = 82230,
442     Iop_QSub64Ux1 = 82231,   442     Iop_QSub64Ux1 = 82231,
443     Iop_QSub8Sx8 = 82232,   443     Iop_QSub8Sx8 = 82232,
444     Iop_QSub16Sx4 = 82233,   444     Iop_QSub16Sx4 = 82233,
445     Iop_QSub32Sx2 = 82234,   445     Iop_QSub32Sx2 = 82234,
446     Iop_QSub64Sx1 = 82235,   446     Iop_QSub64Sx1 = 82235,
447     Iop_Abs8x8 = 82236,   447     Iop_Abs8x8 = 82236,
448     Iop_Abs16x4 = 82237,   448     Iop_Abs16x4 = 82237,
449     Iop_Abs32x2 = 82238,   449     Iop_Abs32x2 = 82238,
450     Iop_Mul8x8 = 82239,   450     Iop_Mul8x8 = 82239,
451     Iop_Mul16x4 = 82240,   451     Iop_Mul16x4 = 82240,
452     Iop_Mul32x2 = 82241,   452     Iop_Mul32x2 = 82241,
453     Iop_Mul32Fx2 = 82242,   453     Iop_Mul32Fx2 = 82242,
454     Iop_MulHi16Ux4 = 82243,   454     Iop_MulHi16Ux4 = 82243,
455     Iop_MulHi16Sx4 = 82244,   455     Iop_MulHi16Sx4 = 82244,
456     Iop_PolynomialMul8x8 = 82245,   456     Iop_PolynomialMul8x8 = 82245,
457     Iop_QDMulHi16Sx4 = 82246,   457     Iop_QDMulHi16Sx4 = 82246,
458     Iop_QDMulHi32Sx2 = 82247,   458     Iop_QDMulHi32Sx2 = 82247,
459     Iop_QRDMulHi16Sx4 = 82248,   459     Iop_QRDMulHi16Sx4 = 82248,
460     Iop_QRDMulHi32Sx2 = 82249,   460     Iop_QRDMulHi32Sx2 = 82249,
461     Iop_Avg8Ux8 = 82250,   461     Iop_Avg8Ux8 = 82250,
462     Iop_Avg16Ux4 = 82251,   462     Iop_Avg16Ux4 = 82251,
463     Iop_Max8Sx8 = 82252,   463     Iop_Max8Sx8 = 82252,
464     Iop_Max16Sx4 = 82253,   464     Iop_Max16Sx4 = 82253,
465     Iop_Max32Sx2 = 82254,   465     Iop_Max32Sx2 = 82254,
466     Iop_Max8Ux8 = 82255,   466     Iop_Max8Ux8 = 82255,
467     Iop_Max16Ux4 = 82256,   467     Iop_Max16Ux4 = 82256,
468     Iop_Max32Ux2 = 82257,   468     Iop_Max32Ux2 = 82257,
469     Iop_Min8Sx8 = 82258,   469     Iop_Min8Sx8 = 82258,
470     Iop_Min16Sx4 = 82259,   470     Iop_Min16Sx4 = 82259,
471     Iop_Min32Sx2 = 82260,   471     Iop_Min32Sx2 = 82260,
472     Iop_Min8Ux8 = 82261,   472     Iop_Min8Ux8 = 82261,
473     Iop_Min16Ux4 = 82262,   473     Iop_Min16Ux4 = 82262,
474     Iop_Min32Ux2 = 82263,   474     Iop_Min32Ux2 = 82263,
475     Iop_CmpEQ8x8 = 82264,   475     Iop_CmpEQ8x8 = 82264,
476     Iop_CmpEQ16x4 = 82265,   476     Iop_CmpEQ16x4 = 82265,
477     Iop_CmpEQ32x2 = 82266,   477     Iop_CmpEQ32x2 = 82266,
478     Iop_CmpGT8Ux8 = 82267,   478     Iop_CmpGT8Ux8 = 82267,
479     Iop_CmpGT16Ux4 = 82268,   479     Iop_CmpGT16Ux4 = 82268,
480     Iop_CmpGT32Ux2 = 82269,   480     Iop_CmpGT32Ux2 = 82269,
481     Iop_CmpGT8Sx8 = 82270,   481     Iop_CmpGT8Sx8 = 82270,
482     Iop_CmpGT16Sx4 = 82271,   482     Iop_CmpGT16Sx4 = 82271,
483     Iop_CmpGT32Sx2 = 82272,   483     Iop_CmpGT32Sx2 = 82272,
484     Iop_Cnt8x8 = 82273,   484     Iop_Cnt8x8 = 82273,
485     Iop_Clz8Sx8 = 82274,   485     Iop_Clz8Sx8 = 82274,
486     Iop_Clz16Sx4 = 82275,   486     Iop_Clz16Sx4 = 82275,
487     Iop_Clz32Sx2 = 82276,   487     Iop_Clz32Sx2 = 82276,
488     Iop_Cls8Sx8 = 82277,   488     Iop_Cls8Sx8 = 82277,
489     Iop_Cls16Sx4 = 82278,   489     Iop_Cls16Sx4 = 82278,
490     Iop_Cls32Sx2 = 82279,   490     Iop_Cls32Sx2 = 82279,
491     Iop_Shl8x8 = 82280,   491     Iop_Shl8x8 = 82280,
492     Iop_Shl16x4 = 82281,   492     Iop_Shl16x4 = 82281,
493     Iop_Shl32x2 = 82282,   493     Iop_Shl32x2 = 82282,
494     Iop_Shr8x8 = 82283,   494     Iop_Shr8x8 = 82283,
495     Iop_Shr16x4 = 82284,   495     Iop_Shr16x4 = 82284,
496     Iop_Shr32x2 = 82285,   496     Iop_Shr32x2 = 82285,
497     Iop_Sar8x8 = 82286,   497     Iop_Sar8x8 = 82286,
498     Iop_Sar16x4 = 82287,   498     Iop_Sar16x4 = 82287,
499     Iop_Sar32x2 = 82288,   499     Iop_Sar32x2 = 82288,
500     Iop_Sal8x8 = 82289,   500     Iop_Sal8x8 = 82289,
501     Iop_Sal16x4 = 82290,   501     Iop_Sal16x4 = 82290,
502     Iop_Sal32x2 = 82291,   502     Iop_Sal32x2 = 82291,
503     Iop_Sal64x1 = 82292,   503     Iop_Sal64x1 = 82292,
504     Iop_ShlN8x8 = 82293,   504     Iop_ShlN8x8 = 82293,
505     Iop_ShlN16x4 = 82294,   505     Iop_ShlN16x4 = 82294,
506     Iop_ShlN32x2 = 82295,   506     Iop_ShlN32x2 = 82295,
507     Iop_ShrN8x8 = 82296,   507     Iop_ShrN8x8 = 82296,
508     Iop_ShrN16x4 = 82297,   508     Iop_ShrN16x4 = 82297,
509     Iop_ShrN32x2 = 82298,   509     Iop_ShrN32x2 = 82298,
510     Iop_SarN8x8 = 82299,   510     Iop_SarN8x8 = 82299,
511     Iop_SarN16x4 = 82300,   511     Iop_SarN16x4 = 82300,
512     Iop_SarN32x2 = 82301,   512     Iop_SarN32x2 = 82301,
513     Iop_QShl8x8 = 82302,   513     Iop_QShl8x8 = 82302,
514     Iop_QShl16x4 = 82303,   514     Iop_QShl16x4 = 82303,
515     Iop_QShl32x2 = 82304,   515     Iop_QShl32x2 = 82304,
516     Iop_QShl64x1 = 82305,   516     Iop_QShl64x1 = 82305,
517     Iop_QSal8x8 = 82306,   517     Iop_QSal8x8 = 82306,
518     Iop_QSal16x4 = 82307,   518     Iop_QSal16x4 = 82307,
519     Iop_QSal32x2 = 82308,   519     Iop_QSal32x2 = 82308,
520     Iop_QSal64x1 = 82309,   520     Iop_QSal64x1 = 82309,
521     Iop_QShlN8Sx8 = 82310,   521     Iop_QShlN8Sx8 = 82310,
522     Iop_QShlN16Sx4 = 82311,   522     Iop_QShlN16Sx4 = 82311,
523     Iop_QShlN32Sx2 = 82312,   523     Iop_QShlN32Sx2 = 82312,
524     Iop_QShlN64Sx1 = 82313,   524     Iop_QShlN64Sx1 = 82313,
525     Iop_QShlN8x8 = 82314,   525     Iop_QShlN8x8 = 82314,
526     Iop_QShlN16x4 = 82315,   526     Iop_QShlN16x4 = 82315,
527     Iop_QShlN32x2 = 82316,   527     Iop_QShlN32x2 = 82316,
528     Iop_QShlN64x1 = 82317,   528     Iop_QShlN64x1 = 82317,
529     Iop_QSalN8x8 = 82318,   529     Iop_QSalN8x8 = 82318,
530     Iop_QSalN16x4 = 82319,   530     Iop_QSalN16x4 = 82319,
531     Iop_QSalN32x2 = 82320,   531     Iop_QSalN32x2 = 82320,
532     Iop_QSalN64x1 = 82321,   532     Iop_QSalN64x1 = 82321,
533     Iop_QNarrow16Ux4 = 82322,   533     Iop_QNarrow16Ux4 = 82322,
534     Iop_QNarrow16Sx4 = 82323,   534     Iop_QNarrow16Sx4 = 82323,
535     Iop_QNarrow32Sx2 = 82324,   535     Iop_QNarrow32Sx2 = 82324,
536     Iop_InterleaveHI8x8 = 82325,   536     Iop_InterleaveHI8x8 = 82325,
537     Iop_InterleaveHI16x4 = 82326,   537     Iop_InterleaveHI16x4 = 82326,
538     Iop_InterleaveHI32x2 = 82327,   538     Iop_InterleaveHI32x2 = 82327,
539     Iop_InterleaveLO8x8 = 82328,   539     Iop_InterleaveLO8x8 = 82328,
540     Iop_InterleaveLO16x4 = 82329,   540     Iop_InterleaveLO16x4 = 82329,
541     Iop_InterleaveLO32x2 = 82330,   541     Iop_InterleaveLO32x2 = 82330,
542     Iop_InterleaveOddLanes8x8 = 82331,   542     Iop_InterleaveOddLanes8x8 = 82331,
543     Iop_InterleaveEvenLanes8x8 = 82332,   543     Iop_InterleaveEvenLanes8x8 = 82332,
544     Iop_InterleaveOddLanes16x4 = 82333,   544     Iop_InterleaveOddLanes16x4 = 82333,
545     Iop_InterleaveEvenLanes16x4 = 82334,   545     Iop_InterleaveEvenLanes16x4 = 82334,
546     Iop_CatOddLanes8x8 = 82335,   546     Iop_CatOddLanes8x8 = 82335,
547     Iop_CatOddLanes16x4 = 82336,   547     Iop_CatOddLanes16x4 = 82336,
548     Iop_CatEvenLanes8x8 = 82337,   548     Iop_CatEvenLanes8x8 = 82337,
549     Iop_CatEvenLanes16x4 = 82338,   549     Iop_CatEvenLanes16x4 = 82338,
550     Iop_GetElem8x8 = 82339,   550     Iop_GetElem8x8 = 82339,
551     Iop_GetElem16x4 = 82340,   551     Iop_GetElem16x4 = 82340,
552     Iop_GetElem32x2 = 82341,   552     Iop_GetElem32x2 = 82341,
553     Iop_SetElem8x8 = 82342,   553     Iop_SetElem8x8 = 82342,
554     Iop_SetElem16x4 = 82343,   554     Iop_SetElem16x4 = 82343,
555     Iop_SetElem32x2 = 82344,   555     Iop_SetElem32x2 = 82344,
556     Iop_Dup8x8 = 82345,   556     Iop_Dup8x8 = 82345,
557     Iop_Dup16x4 = 82346,   557     Iop_Dup16x4 = 82346,
558     Iop_Dup32x2 = 82347,   558     Iop_Dup32x2 = 82347,
559     Iop_Extract64 = 82348,   559     Iop_Extract64 = 82348,
560     Iop_Reverse16_8x8 = 82349,   560     Iop_Reverse16_8x8 = 82349,
561     Iop_Reverse32_8x8 = 82350,   561     Iop_Reverse32_8x8 = 82350,
562     Iop_Reverse32_16x4 = 82351,   562     Iop_Reverse32_16x4 = 82351,
563     Iop_Reverse64_8x8 = 82352,   563     Iop_Reverse64_8x8 = 82352,
564     Iop_Reverse64_16x4 = 82353,   564     Iop_Reverse64_16x4 = 82353,
565     Iop_Reverse64_32x2 = 82354,   565     Iop_Reverse64_32x2 = 82354,
566     Iop_Perm8x8 = 82355,   566     Iop_Perm8x8 = 82355,
567     Iop_Recip32x2 = 82356,   567     Iop_Recip32x2 = 82356,
568     Iop_Rsqrte32x2 = 82357,   568     Iop_Rsqrte32x2 = 82357,
569     Iop_Add32Fx4 = 82358,   569     Iop_Add32Fx4 = 82358,
570     Iop_Sub32Fx4 = 82359,   570     Iop_Sub32Fx4 = 82359,
571     Iop_Mul32Fx4 = 82360,   571     Iop_Mul32Fx4 = 82360,
572     Iop_Div32Fx4 = 82361,   572     Iop_Div32Fx4 = 82361,
573     Iop_Max32Fx4 = 82362,   573     Iop_Max32Fx4 = 82362,
574     Iop_Min32Fx4 = 82363,   574     Iop_Min32Fx4 = 82363,
575     Iop_Add32Fx2 = 82364,   575     Iop_Add32Fx2 = 82364,
576     Iop_Sub32Fx2 = 82365,   576     Iop_Sub32Fx2 = 82365,
577     Iop_CmpEQ32Fx4 = 82366,   577     Iop_CmpEQ32Fx4 = 82366,
578     Iop_CmpLT32Fx4 = 82367,   578     Iop_CmpLT32Fx4 = 82367,
579     Iop_CmpLE32Fx4 = 82368,   579     Iop_CmpLE32Fx4 = 82368,
580     Iop_CmpUN32Fx4 = 82369,   580     Iop_CmpUN32Fx4 = 82369,
581     Iop_CmpGT32Fx4 = 82370,   581     Iop_CmpGT32Fx4 = 82370,
582     Iop_CmpGE32Fx4 = 82371,   582     Iop_CmpGE32Fx4 = 82371,
583     Iop_Abs32Fx4 = 82372,   583     Iop_Abs32Fx4 = 82372,
584     Iop_PwMax32Fx4 = 82373,   584     Iop_PwMax32Fx4 = 82373,
585     Iop_PwMin32Fx4 = 82374,   585     Iop_PwMin32Fx4 = 82374,
586     Iop_Sqrt32Fx4 = 82375,   586     Iop_Sqrt32Fx4 = 82375,
587     Iop_RSqrt32Fx4 = 82376,   587     Iop_RSqrt32Fx4 = 82376,
588     Iop_Neg32Fx4 = 82377,   588     Iop_Neg32Fx4 = 82377,
589     Iop_Recip32Fx4 = 82378,   589     Iop_Recip32Fx4 = 82378,
590     Iop_Recps32Fx4 = 82379,   590     Iop_Recps32Fx4 = 82379,
591     Iop_Rsqrte32Fx4 = 82380,   591     Iop_Rsqrte32Fx4 = 82380,
592     Iop_Rsqrts32Fx4 = 82381,   592     Iop_Rsqrts32Fx4 = 82381,
593     Iop_I32UtoFx4 = 82382,   593     Iop_I32UtoFx4 = 82382,
594     Iop_I32StoFx4 = 82383,   594     Iop_I32StoFx4 = 82383,
595     Iop_FtoI32Ux4_RZ = 82384,   595     Iop_FtoI32Ux4_RZ = 82384,
596     Iop_FtoI32Sx4_RZ = 82385,   596     Iop_FtoI32Sx4_RZ = 82385,
597     Iop_QFtoI32Ux4_RZ = 82386,   597     Iop_QFtoI32Ux4_RZ = 82386,
598     Iop_QFtoI32Sx4_RZ = 82387,   598     Iop_QFtoI32Sx4_RZ = 82387,
599     Iop_RoundF32x4_RM = 82388,   599     Iop_RoundF32x4_RM = 82388,
600     Iop_RoundF32x4_RP = 82389,   600     Iop_RoundF32x4_RP = 82389,
601     Iop_RoundF32x4_RN = 82390,   601     Iop_RoundF32x4_RN = 82390,
602     Iop_RoundF32x4_RZ = 82391,   602     Iop_RoundF32x4_RZ = 82391,
603     Iop_F32ToFixed32Ux4_RZ = 82392,   603     Iop_F32ToFixed32Ux4_RZ = 82392,
604     Iop_F32ToFixed32Sx4_RZ = 82393,   604     Iop_F32ToFixed32Sx4_RZ = 82393,
605     Iop_Fixed32UToF32x4_RN = 82394,   605     Iop_Fixed32UToF32x4_RN = 82394,
606     Iop_Fixed32SToF32x4_RN = 82395,   606     Iop_Fixed32SToF32x4_RN = 82395,
607     Iop_F32toF16x4 = 82396,   607     Iop_F32toF16x4 = 82396,
608     Iop_F16toF32x4 = 82397,   608     Iop_F16toF32x4 = 82397,
609     Iop_Add32F0x4 = 82398,   609     Iop_Add32F0x4 = 82398,
610     Iop_Sub32F0x4 = 82399,   610     Iop_Sub32F0x4 = 82399,
611     Iop_Mul32F0x4 = 82400,   611     Iop_Mul32F0x4 = 82400,
612     Iop_Div32F0x4 = 82401,   612     Iop_Div32F0x4 = 82401,
613     Iop_Max32F0x4 = 82402,   613     Iop_Max32F0x4 = 82402,
614     Iop_Min32F0x4 = 82403,   614     Iop_Min32F0x4 = 82403,
615     Iop_CmpEQ32F0x4 = 82404,   615     Iop_CmpEQ32F0x4 = 82404,
616     Iop_CmpLT32F0x4 = 82405,   616     Iop_CmpLT32F0x4 = 82405,
617     Iop_CmpLE32F0x4 = 82406,   617     Iop_CmpLE32F0x4 = 82406,
618     Iop_CmpUN32F0x4 = 82407,   618     Iop_CmpUN32F0x4 = 82407,
619     Iop_Recip32F0x4 = 82408,   619     Iop_Recip32F0x4 = 82408,
620     Iop_Sqrt32F0x4 = 82409,   620     Iop_Sqrt32F0x4 = 82409,
621     Iop_RSqrt32F0x4 = 82410,   621     Iop_RSqrt32F0x4 = 82410,
622     Iop_Add64Fx2 = 82411,   622     Iop_Add64Fx2 = 82411,
623     Iop_Sub64Fx2 = 82412,   623     Iop_Sub64Fx2 = 82412,
624     Iop_Mul64Fx2 = 82413,   624     Iop_Mul64Fx2 = 82413,
625     Iop_Div64Fx2 = 82414,   625     Iop_Div64Fx2 = 82414,
626     Iop_Max64Fx2 = 82415,   626     Iop_Max64Fx2 = 82415,
627     Iop_Min64Fx2 = 82416,   627     Iop_Min64Fx2 = 82416,
628     Iop_CmpEQ64Fx2 = 82417,   628     Iop_CmpEQ64Fx2 = 82417,
629     Iop_CmpLT64Fx2 = 82418,   629     Iop_CmpLT64Fx2 = 82418,
630     Iop_CmpLE64Fx2 = 82419,   630     Iop_CmpLE64Fx2 = 82419,
631     Iop_CmpUN64Fx2 = 82420,   631     Iop_CmpUN64Fx2 = 82420,
632     Iop_Recip64Fx2 = 82421,   632     Iop_Recip64Fx2 = 82421,
633     Iop_Sqrt64Fx2 = 82422,   633     Iop_Sqrt64Fx2 = 82422,
634     Iop_RSqrt64Fx2 = 82423,   634     Iop_RSqrt64Fx2 = 82423,
635     Iop_Add64F0x2 = 82424,   635     Iop_Add64F0x2 = 82424,
636     Iop_Sub64F0x2 = 82425,   636     Iop_Sub64F0x2 = 82425,
637     Iop_Mul64F0x2 = 82426,   637     Iop_Mul64F0x2 = 82426,
638     Iop_Div64F0x2 = 82427,   638     Iop_Div64F0x2 = 82427,
639     Iop_Max64F0x2 = 82428,   639     Iop_Max64F0x2 = 82428,
640     Iop_Min64F0x2 = 82429,   640     Iop_Min64F0x2 = 82429,
641     Iop_CmpEQ64F0x2 = 82430,   641     Iop_CmpEQ64F0x2 = 82430,
642     Iop_CmpLT64F0x2 = 82431,   642     Iop_CmpLT64F0x2 = 82431,
643     Iop_CmpLE64F0x2 = 82432,   643     Iop_CmpLE64F0x2 = 82432,
644     Iop_CmpUN64F0x2 = 82433,   644     Iop_CmpUN64F0x2 = 82433,
645     Iop_Recip64F0x2 = 82434,   645     Iop_Recip64F0x2 = 82434,
646     Iop_Sqrt64F0x2 = 82435,   646     Iop_Sqrt64F0x2 = 82435,
647     Iop_RSqrt64F0x2 = 82436,   647     Iop_RSqrt64F0x2 = 82436,
648     Iop_V128to64 = 82437,   648     Iop_V128to64 = 82437,
649     Iop_V128HIto64 = 82438,   649     Iop_V128HIto64 = 82438,
650     Iop_64HLtoV128 = 82439,   650     Iop_64HLtoV128 = 82439,
651     Iop_64UtoV128 = 82440,   651     Iop_64UtoV128 = 82440,
652     Iop_SetV128lo64 = 82441,   652     Iop_SetV128lo64 = 82441,
653     Iop_32UtoV128 = 82442,   653     Iop_32UtoV128 = 82442,
654     Iop_V128to32 = 82443,   654     Iop_V128to32 = 82443,
655     Iop_SetV128lo32 = 82444,   655     Iop_SetV128lo32 = 82444,
656     Iop_NotV128 = 82445,   656     Iop_NotV128 = 82445,
657     Iop_AndV128 = 82446,   657     Iop_AndV128 = 82446,
658     Iop_OrV128 = 82447,   658     Iop_OrV128 = 82447,
659     Iop_XorV128 = 82448,   659     Iop_XorV128 = 82448,
660     Iop_ShlV128 = 82449,   660     Iop_ShlV128 = 82449,
661     Iop_ShrV128 = 82450,   661     Iop_ShrV128 = 82450,
662     Iop_CmpNEZ8x16 = 82451,   662     Iop_CmpNEZ8x16 = 82451,
663     Iop_CmpNEZ16x8 = 82452,   663     Iop_CmpNEZ16x8 = 82452,
664     Iop_CmpNEZ32x4 = 82453,   664     Iop_CmpNEZ32x4 = 82453,
665     Iop_CmpNEZ64x2 = 82454,   665     Iop_CmpNEZ64x2 = 82454,
666     Iop_Add8x16 = 82455,   666     Iop_Add8x16 = 82455,
667     Iop_Add16x8 = 82456,   667     Iop_Add16x8 = 82456,
668     Iop_Add32x4 = 82457,   668     Iop_Add32x4 = 82457,
669     Iop_Add64x2 = 82458,   669     Iop_Add64x2 = 82458,
670     Iop_QAdd8Ux16 = 82459,   670     Iop_QAdd8Ux16 = 82459,
671     Iop_QAdd16Ux8 = 82460,   671     Iop_QAdd16Ux8 = 82460,
672     Iop_QAdd32Ux4 = 82461,   672     Iop_QAdd32Ux4 = 82461,
673     Iop_QAdd64Ux2 = 82462,   673     Iop_QAdd64Ux2 = 82462,
674     Iop_QAdd8Sx16 = 82463,   674     Iop_QAdd8Sx16 = 82463,
675     Iop_QAdd16Sx8 = 82464,   675     Iop_QAdd16Sx8 = 82464,
676     Iop_QAdd32Sx4 = 82465,   676     Iop_QAdd32Sx4 = 82465,
677     Iop_QAdd64Sx2 = 82466,   677     Iop_QAdd64Sx2 = 82466,
678     Iop_Sub8x16 = 82467,   678     Iop_Sub8x16 = 82467,
679     Iop_Sub16x8 = 82468,   679     Iop_Sub16x8 = 82468,
680     Iop_Sub32x4 = 82469,   680     Iop_Sub32x4 = 82469,
681     Iop_Sub64x2 = 82470,   681     Iop_Sub64x2 = 82470,
682     Iop_QSub8Ux16 = 82471,   682     Iop_QSub8Ux16 = 82471,
683     Iop_QSub16Ux8 = 82472,   683     Iop_QSub16Ux8 = 82472,
684     Iop_QSub32Ux4 = 82473,   684     Iop_QSub32Ux4 = 82473,
685     Iop_QSub64Ux2 = 82474,   685     Iop_QSub64Ux2 = 82474,
686     Iop_QSub8Sx16 = 82475,   686     Iop_QSub8Sx16 = 82475,
687     Iop_QSub16Sx8 = 82476,   687     Iop_QSub16Sx8 = 82476,
688     Iop_QSub32Sx4 = 82477,   688     Iop_QSub32Sx4 = 82477,
689     Iop_QSub64Sx2 = 82478,   689     Iop_QSub64Sx2 = 82478,
690     Iop_Mul8x16 = 82479,   690     Iop_Mul8x16 = 82479,
691     Iop_Mul16x8 = 82480,   691     Iop_Mul16x8 = 82480,
692     Iop_Mul32x4 = 82481,   692     Iop_Mul32x4 = 82481,
693     Iop_MulHi16Ux8 = 82482,   693     Iop_MulHi16Ux8 = 82482,
694     Iop_MulHi32Ux4 = 82483,   694     Iop_MulHi32Ux4 = 82483,
695     Iop_MulHi16Sx8 = 82484,   695     Iop_MulHi16Sx8 = 82484,
696     Iop_MulHi32Sx4 = 82485,   696     Iop_MulHi32Sx4 = 82485,
697     Iop_MullEven8Ux16 = 82486,   697     Iop_MullEven8Ux16 = 82486,
698     Iop_MullEven16Ux8 = 82487,   698     Iop_MullEven16Ux8 = 82487,
699     Iop_MullEven8Sx16 = 82488,   699     Iop_MullEven8Sx16 = 82488,
700     Iop_MullEven16Sx8 = 82489,   700     Iop_MullEven16Sx8 = 82489,
701     Iop_Mull8Ux8 = 82490,   701     Iop_Mull8Ux8 = 82490,
702     Iop_Mull8Sx8 = 82491,   702     Iop_Mull8Sx8 = 82491,
703     Iop_Mull16Ux4 = 82492,   703     Iop_Mull16Ux4 = 82492,
704     Iop_Mull16Sx4 = 82493,   704     Iop_Mull16Sx4 = 82493,
705     Iop_Mull32Ux2 = 82494,   705     Iop_Mull32Ux2 = 82494,
706     Iop_Mull32Sx2 = 82495,   706     Iop_Mull32Sx2 = 82495,
707     Iop_QDMulHi16Sx8 = 82496,   707     Iop_QDMulHi16Sx8 = 82496,
708     Iop_QDMulHi32Sx4 = 82497,   708     Iop_QDMulHi32Sx4 = 82497,
709     Iop_QRDMulHi16Sx8 = 82498,   709     Iop_QRDMulHi16Sx8 = 82498,
710     Iop_QRDMulHi32Sx4 = 82499,   710     Iop_QRDMulHi32Sx4 = 82499,
711     Iop_QDMulLong16Sx4 = 82500,   711     Iop_QDMulLong16Sx4 = 82500,
712     Iop_QDMulLong32Sx2 = 82501,   712     Iop_QDMulLong32Sx2 = 82501,
713     Iop_PolynomialMul8x16 = 82502,   713     Iop_PolynomialMul8x16 = 82502,
714     Iop_PolynomialMull8x8 = 82503,   714     Iop_PolynomialMull8x8 = 82503,
715     Iop_PwAdd8x16 = 82504,   715     Iop_PwAdd8x16 = 82504,
716     Iop_PwAdd16x8 = 82505,   716     Iop_PwAdd16x8 = 82505,
717     Iop_PwAdd32x4 = 82506,   717     Iop_PwAdd32x4 = 82506,
718     Iop_PwAdd32Fx2 = 82507,   718     Iop_PwAdd32Fx2 = 82507,
719     Iop_PwAddL8Ux16 = 82508,   719     Iop_PwAddL8Ux16 = 82508,
720     Iop_PwAddL16Ux8 = 82509,   720     Iop_PwAddL16Ux8 = 82509,
721     Iop_PwAddL32Ux4 = 82510,   721     Iop_PwAddL32Ux4 = 82510,
722     Iop_PwAddL8Sx16 = 82511,   722     Iop_PwAddL8Sx16 = 82511,
723     Iop_PwAddL16Sx8 = 82512,   723     Iop_PwAddL16Sx8 = 82512,
724     Iop_PwAddL32Sx4 = 82513,   724     Iop_PwAddL32Sx4 = 82513,
725     Iop_Abs8x16 = 82514,   725     Iop_Abs8x16 = 82514,
726     Iop_Abs16x8 = 82515,   726     Iop_Abs16x8 = 82515,
727     Iop_Abs32x4 = 82516,   727     Iop_Abs32x4 = 82516,
728     Iop_Avg8Ux16 = 82517,   728     Iop_Avg8Ux16 = 82517,
729     Iop_Avg16Ux8 = 82518,   729     Iop_Avg16Ux8 = 82518,
730     Iop_Avg32Ux4 = 82519,   730     Iop_Avg32Ux4 = 82519,
731     Iop_Avg8Sx16 = 82520,   731     Iop_Avg8Sx16 = 82520,
732     Iop_Avg16Sx8 = 82521,   732     Iop_Avg16Sx8 = 82521,
733     Iop_Avg32Sx4 = 82522,   733     Iop_Avg32Sx4 = 82522,
734     Iop_Max8Sx16 = 82523,   734     Iop_Max8Sx16 = 82523,
735     Iop_Max16Sx8 = 82524,   735     Iop_Max16Sx8 = 82524,
736     Iop_Max32Sx4 = 82525,   736     Iop_Max32Sx4 = 82525,
737     Iop_Max8Ux16 = 82526,   737     Iop_Max8Ux16 = 82526,
738     Iop_Max16Ux8 = 82527,   738     Iop_Max16Ux8 = 82527,
739     Iop_Max32Ux4 = 82528,   739     Iop_Max32Ux4 = 82528,
740     Iop_Min8Sx16 = 82529,   740     Iop_Min8Sx16 = 82529,
741     Iop_Min16Sx8 = 82530,   741     Iop_Min16Sx8 = 82530,
742     Iop_Min32Sx4 = 82531,   742     Iop_Min32Sx4 = 82531,
743     Iop_Min8Ux16 = 82532,   743     Iop_Min8Ux16 = 82532,
744     Iop_Min16Ux8 = 82533,   744     Iop_Min16Ux8 = 82533,
745     Iop_Min32Ux4 = 82534,   745     Iop_Min32Ux4 = 82534,
746     Iop_CmpEQ8x16 = 82535,   746     Iop_CmpEQ8x16 = 82535,
747     Iop_CmpEQ16x8 = 82536,   747     Iop_CmpEQ16x8 = 82536,
748     Iop_CmpEQ32x4 = 82537,   748     Iop_CmpEQ32x4 = 82537,
749     Iop_CmpGT8Sx16 = 82538,   749     Iop_CmpGT8Sx16 = 82538,
750     Iop_CmpGT16Sx8 = 82539,   750     Iop_CmpGT16Sx8 = 82539,
751     Iop_CmpGT32Sx4 = 82540,   751     Iop_CmpGT32Sx4 = 82540,
752     Iop_CmpGT64Sx2 = 82541,   752     Iop_CmpGT64Sx2 = 82541,
753     Iop_CmpGT8Ux16 = 82542,   753     Iop_CmpGT8Ux16 = 82542,
754     Iop_CmpGT16Ux8 = 82543,   754     Iop_CmpGT16Ux8 = 82543,
755     Iop_CmpGT32Ux4 = 82544,   755     Iop_CmpGT32Ux4 = 82544,
756     Iop_Cnt8x16 = 82545,   756     Iop_Cnt8x16 = 82545,
757     Iop_Clz8Sx16 = 82546,   757     Iop_Clz8Sx16 = 82546,
758     Iop_Clz16Sx8 = 82547,   758     Iop_Clz16Sx8 = 82547,
759     Iop_Clz32Sx4 = 82548,   759     Iop_Clz32Sx4 = 82548,
760     Iop_Cls8Sx16 = 82549,   760     Iop_Cls8Sx16 = 82549,
761     Iop_Cls16Sx8 = 82550,   761     Iop_Cls16Sx8 = 82550,
762     Iop_Cls32Sx4 = 82551,   762     Iop_Cls32Sx4 = 82551,
763     Iop_ShlN8x16 = 82552,   763     Iop_ShlN8x16 = 82552,
764     Iop_ShlN16x8 = 82553,   764     Iop_ShlN16x8 = 82553,
765     Iop_ShlN32x4 = 82554,   765     Iop_ShlN32x4 = 82554,
766     Iop_ShlN64x2 = 82555,   766     Iop_ShlN64x2 = 82555,
767     Iop_ShrN8x16 = 82556,   767     Iop_ShrN8x16 = 82556,
768     Iop_ShrN16x8 = 82557,   768     Iop_ShrN16x8 = 82557,
769     Iop_ShrN32x4 = 82558,   769     Iop_ShrN32x4 = 82558,
770     Iop_ShrN64x2 = 82559,   770     Iop_ShrN64x2 = 82559,
771     Iop_SarN8x16 = 82560,   771     Iop_SarN8x16 = 82560,
772     Iop_SarN16x8 = 82561,   772     Iop_SarN16x8 = 82561,
773     Iop_SarN32x4 = 82562,   773     Iop_SarN32x4 = 82562,
774     Iop_SarN64x2 = 82563,   774     Iop_SarN64x2 = 82563,
775     Iop_Shl8x16 = 82564,   775     Iop_Shl8x16 = 82564,
776     Iop_Shl16x8 = 82565,   776     Iop_Shl16x8 = 82565,
777     Iop_Shl32x4 = 82566,   777     Iop_Shl32x4 = 82566,
778     Iop_Shl64x2 = 82567,   778     Iop_Shl64x2 = 82567,
779     Iop_Shr8x16 = 82568,   779     Iop_Shr8x16 = 82568,
780     Iop_Shr16x8 = 82569,   780     Iop_Shr16x8 = 82569,
781     Iop_Shr32x4 = 82570,   781     Iop_Shr32x4 = 82570,
782     Iop_Shr64x2 = 82571,   782     Iop_Shr64x2 = 82571,
783     Iop_Sar8x16 = 82572,   783     Iop_Sar8x16 = 82572,
784     Iop_Sar16x8 = 82573,   784     Iop_Sar16x8 = 82573,
785     Iop_Sar32x4 = 82574,   785     Iop_Sar32x4 = 82574,
786     Iop_Sar64x2 = 82575,   786     Iop_Sar64x2 = 82575,
787     Iop_Sal8x16 = 82576,   787     Iop_Sal8x16 = 82576,
788     Iop_Sal16x8 = 82577,   788     Iop_Sal16x8 = 82577,
789     Iop_Sal32x4 = 82578,   789     Iop_Sal32x4 = 82578,
790     Iop_Sal64x2 = 82579,   790     Iop_Sal64x2 = 82579,
791     Iop_Rol8x16 = 82580,   791     Iop_Rol8x16 = 82580,
792     Iop_Rol16x8 = 82581,   792     Iop_Rol16x8 = 82581,
793     Iop_Rol32x4 = 82582,   793     Iop_Rol32x4 = 82582,
794     Iop_QShl8x16 = 82583,   794     Iop_QShl8x16 = 82583,
795     Iop_QShl16x8 = 82584,   795     Iop_QShl16x8 = 82584,
796     Iop_QShl32x4 = 82585,   796     Iop_QShl32x4 = 82585,
797     Iop_QShl64x2 = 82586,   797     Iop_QShl64x2 = 82586,
798     Iop_QSal8x16 = 82587,   798     Iop_QSal8x16 = 82587,
799     Iop_QSal16x8 = 82588,   799     Iop_QSal16x8 = 82588,
800     Iop_QSal32x4 = 82589,   800     Iop_QSal32x4 = 82589,
801     Iop_QSal64x2 = 82590,   801     Iop_QSal64x2 = 82590,
802     Iop_QShlN8Sx16 = 82591,   802     Iop_QShlN8Sx16 = 82591,
803     Iop_QShlN16Sx8 = 82592,   803     Iop_QShlN16Sx8 = 82592,
804     Iop_QShlN32Sx4 = 82593,   804     Iop_QShlN32Sx4 = 82593,
805     Iop_QShlN64Sx2 = 82594,   805     Iop_QShlN64Sx2 = 82594,
806     Iop_QShlN8x16 = 82595,   806     Iop_QShlN8x16 = 82595,
807     Iop_QShlN16x8 = 82596,   807     Iop_QShlN16x8 = 82596,
808     Iop_QShlN32x4 = 82597,   808     Iop_QShlN32x4 = 82597,
809     Iop_QShlN64x2 = 82598,   809     Iop_QShlN64x2 = 82598,
810     Iop_QSalN8x16 = 82599,   810     Iop_QSalN8x16 = 82599,
811     Iop_QSalN16x8 = 82600,   811     Iop_QSalN16x8 = 82600,
812     Iop_QSalN32x4 = 82601,   812     Iop_QSalN32x4 = 82601,
813     Iop_QSalN64x2 = 82602,   813     Iop_QSalN64x2 = 82602,
814     Iop_QNarrow16Ux8 = 82603,   814     Iop_QNarrow16Ux8 = 82603,
815     Iop_QNarrow32Ux4 = 82604,   815     Iop_QNarrow32Ux4 = 82604,
816     Iop_QNarrow16Sx8 = 82605,   816     Iop_QNarrow16Sx8 = 82605,
817     Iop_QNarrow32Sx4 = 82606,   817     Iop_QNarrow32Sx4 = 82606,
818     Iop_Narrow16x8 = 82607,   818     Iop_Narrow16x8 = 82607,
819     Iop_Narrow32x4 = 82608,   819     Iop_Narrow32x4 = 82608,
820     Iop_Shorten16x8 = 82609,   820     Iop_Shorten16x8 = 82609,
821     Iop_Shorten32x4 = 82610,   821     Iop_Shorten32x4 = 82610,
822     Iop_Shorten64x2 = 82611,   822     Iop_Shorten64x2 = 82611,
823     Iop_QShortenS16Sx8 = 82612,   823     Iop_QShortenS16Sx8 = 82612,
824     Iop_QShortenS32Sx4 = 82613,   824     Iop_QShortenS32Sx4 = 82613,
825     Iop_QShortenS64Sx2 = 82614,   825     Iop_QShortenS64Sx2 = 82614,
826     Iop_QShortenU16Sx8 = 82615,   826     Iop_QShortenU16Sx8 = 82615,
827     Iop_QShortenU32Sx4 = 82616,   827     Iop_QShortenU32Sx4 = 82616,
828     Iop_QShortenU64Sx2 = 82617,   828     Iop_QShortenU64Sx2 = 82617,
829     Iop_QShortenU16Ux8 = 82618,   829     Iop_QShortenU16Ux8 = 82618,
830     Iop_QShortenU32Ux4 = 82619,   830     Iop_QShortenU32Ux4 = 82619,
831     Iop_QShortenU64Ux2 = 82620,   831     Iop_QShortenU64Ux2 = 82620,
832     Iop_Longen8Ux8 = 82621,   832     Iop_Longen8Ux8 = 82621,
833     Iop_Longen16Ux4 = 82622,   833     Iop_Longen16Ux4 = 82622,
834     Iop_Longen32Ux2 = 82623,   834     Iop_Longen32Ux2 = 82623,
835     Iop_Longen8Sx8 = 82624,   835     Iop_Longen8Sx8 = 82624,
836     Iop_Longen16Sx4 = 82625,   836     Iop_Longen16Sx4 = 82625,
837     Iop_Longen32Sx2 = 82626,   837     Iop_Longen32Sx2 = 82626,
838     Iop_InterleaveHI8x16 = 82627,   838     Iop_InterleaveHI8x16 = 82627,
839     Iop_InterleaveHI16x8 = 82628,   839     Iop_InterleaveHI16x8 = 82628,
840     Iop_InterleaveHI32x4 = 82629,   840     Iop_InterleaveHI32x4 = 82629,
841     Iop_InterleaveHI64x2 = 82630,   841     Iop_InterleaveHI64x2 = 82630,
842     Iop_InterleaveLO8x16 = 82631,   842     Iop_InterleaveLO8x16 = 82631,
843     Iop_InterleaveLO16x8 = 82632,   843     Iop_InterleaveLO16x8 = 82632,
844     Iop_InterleaveLO32x4 = 82633,   844     Iop_InterleaveLO32x4 = 82633,
845     Iop_InterleaveLO64x2 = 82634,   845     Iop_InterleaveLO64x2 = 82634,
846     Iop_InterleaveOddLanes8x16 = 82635,   846     Iop_InterleaveOddLanes8x16 = 82635,
847     Iop_InterleaveEvenLanes8x16 = 82636,   847     Iop_InterleaveEvenLanes8x16 = 82636,
848     Iop_InterleaveOddLanes16x8 = 82637,   848     Iop_InterleaveOddLanes16x8 = 82637,
849     Iop_InterleaveEvenLanes16x8 = 82638,   849     Iop_InterleaveEvenLanes16x8 = 82638,
850     Iop_InterleaveOddLanes32x4 = 82639,   850     Iop_InterleaveOddLanes32x4 = 82639,
851     Iop_InterleaveEvenLanes32x4 = 82640,   851     Iop_InterleaveEvenLanes32x4 = 82640,
852     Iop_CatOddLanes8x16 = 82641,   852     Iop_CatOddLanes8x16 = 82641,
853     Iop_CatOddLanes16x8 = 82642,   853     Iop_CatOddLanes16x8 = 82642,
854     Iop_CatOddLanes32x4 = 82643,   854     Iop_CatOddLanes32x4 = 82643,
855     Iop_CatEvenLanes8x16 = 82644,   855     Iop_CatEvenLanes8x16 = 82644,
856     Iop_CatEvenLanes16x8 = 82645,   856     Iop_CatEvenLanes16x8 = 82645,
857     Iop_CatEvenLanes32x4 = 82646,   857     Iop_CatEvenLanes32x4 = 82646,
858     Iop_GetElem8x16 = 82647,   858     Iop_GetElem8x16 = 82647,
859     Iop_GetElem16x8 = 82648,   859     Iop_GetElem16x8 = 82648,
860     Iop_GetElem32x4 = 82649,   860     Iop_GetElem32x4 = 82649,
861     Iop_GetElem64x2 = 82650,   861     Iop_GetElem64x2 = 82650,
862     Iop_Dup8x16 = 82651,   862     Iop_Dup8x16 = 82651,
863     Iop_Dup16x8 = 82652,   863     Iop_Dup16x8 = 82652,
864     Iop_Dup32x4 = 82653,   864     Iop_Dup32x4 = 82653,
865     Iop_ExtractV128 = 82654,   865     Iop_ExtractV128 = 82654,
866     Iop_Reverse16_8x16 = 82655,   866     Iop_Reverse16_8x16 = 82655,
867     Iop_Reverse32_8x16 = 82656,   867     Iop_Reverse32_8x16 = 82656,
868     Iop_Reverse32_16x8 = 82657,   868     Iop_Reverse32_16x8 = 82657,
869     Iop_Reverse64_8x16 = 82658,   869     Iop_Reverse64_8x16 = 82658,
870     Iop_Reverse64_16x8 = 82659,   870     Iop_Reverse64_16x8 = 82659,
871     Iop_Reverse64_32x4 = 82660,   871     Iop_Reverse64_32x4 = 82660,
872     Iop_Perm8x16 = 82661,   872     Iop_Perm8x16 = 82661,
873     Iop_Recip32x4 = 82662,   873     Iop_Recip32x4 = 82662,
874     Iop_Rsqrte32x4 = 82663   874     Iop_Rsqrte32x4 = 82663
875 } ;   875 } ;
876 typedef enum __anonenum_IROp_12 IROp;   876 typedef enum __anonenum_IROp_12 IROp;
877 enum __anonenum_IRRoundingMode_13 {   877 enum __anonenum_IRRoundingMode_13 {
878     Irrm_NEAREST = 0,   878     Irrm_NEAREST = 0,
879     Irrm_NegINF = 1,   879     Irrm_NegINF = 1,
880     Irrm_PosINF = 2,   880     Irrm_PosINF = 2,
881     Irrm_ZERO = 3   881     Irrm_ZERO = 3
882 } ;   882 } ;
883 typedef enum __anonenum_IRRoundingMode_13 IRRoundingMode;   883 typedef enum __anonenum_IRRoundingMode_13 IRRoundingMode;
884 enum __anonenum_IRCmpF64Result_14 {   884 enum __anonenum_IRCmpF64Result_14 {
885     Ircr_UN = 69,   885     Ircr_UN = 69,
886     Ircr_LT = 1,   886     Ircr_LT = 1,
887     Ircr_GT = 0,   887     Ircr_GT = 0,
888     Ircr_EQ = 64   888     Ircr_EQ = 64
889 } ;   889 } ;
890 typedef enum __anonenum_IRCmpF64Result_14 IRCmpF64Result;   890 typedef enum __anonenum_IRCmpF64Result_14 IRCmpF64Result;
891 typedef IRCmpF64Result IRCmpF32Result;   891 typedef IRCmpF64Result IRCmpF32Result;
892 typedef IRCmpF64Result IRCmpF128Result;   892 typedef IRCmpF64Result IRCmpF128Result;
893 enum __anonenum_IRExprTag_15 {   893 enum __anonenum_IRExprTag_15 {
894     Iex_Binder = 86016,   894     Iex_Binder = 86016,
895     Iex_Get = 86017,   895     Iex_Get = 86017,
896     Iex_GetI = 86018,   896     Iex_GetI = 86018,
897     Iex_RdTmp = 86019,   897     Iex_RdTmp = 86019,
898     Iex_Qop = 86020,   898     Iex_Qop = 86020,
899     Iex_Triop = 86021,   899     Iex_Triop = 86021,
900     Iex_Binop = 86022,   900     Iex_Binop = 86022,
901     Iex_Unop = 86023,   901     Iex_Unop = 86023,
902     Iex_Load = 86024,   902     Iex_Load = 86024,
903     Iex_Const = 86025,   903     Iex_Const = 86025,
904     Iex_Mux0X = 86026,   904     Iex_Mux0X = 86026,
905     Iex_CCall = 86027   905     Iex_CCall = 86027
906 } ;   906 } ;
907 typedef enum __anonenum_IRExprTag_15 IRExprTag;   907 typedef enum __anonenum_IRExprTag_15 IRExprTag;
908 struct _IRExpr;   908 struct _IRExpr;
909 typedef struct _IRExpr IRExpr;   909 typedef struct _IRExpr IRExpr;
910 struct __anonstruct_Binder_17 {   910 struct __anonstruct_Binder_17 {
911    Int binder ;   911    Int binder ;
912 };   912 };
913 struct __anonstruct_Get_18 {   913 struct __anonstruct_Get_18 {
914    Int offset ;   914    Int offset ;
915    IRType ty ;   915    IRType ty ;
916 };   916 };
917 struct __anonstruct_GetI_19 {   917 struct __anonstruct_GetI_19 {
918    IRRegArray *descr ;   918    IRRegArray *descr ;
919    IRExpr *ix ;   919    IRExpr *ix ;
920    Int bias ;   920    Int bias ;
921 };   921 };
922 struct __anonstruct_RdTmp_20 {   922 struct __anonstruct_RdTmp_20 {
923    IRTemp tmp ;   923    IRTemp tmp ;
924 };   924 };
925 struct __anonstruct_Qop_21 {   925 struct __anonstruct_Qop_21 {
926    IROp op ;   926    IROp op ;
927    IRExpr *arg1 ;   927    IRExpr *arg1 ;
928    IRExpr *arg2 ;   928    IRExpr *arg2 ;
929    IRExpr *arg3 ;   929    IRExpr *arg3 ;
930    IRExpr *arg4 ;   930    IRExpr *arg4 ;
931 };   931 };
932 struct __anonstruct_Triop_22 {   932 struct __anonstruct_Triop_22 {
933    IROp op ;   933    IROp op ;
934    IRExpr *arg1 ;   934    IRExpr *arg1 ;
935    IRExpr *arg2 ;   935    IRExpr *arg2 ;
936    IRExpr *arg3 ;   936    IRExpr *arg3 ;
937 };   937 };
938 struct __anonstruct_Binop_23 {   938 struct __anonstruct_Binop_23 {
939    IROp op ;   939    IROp op ;
940    IRExpr *arg1 ;   940    IRExpr *arg1 ;
941    IRExpr *arg2 ;   941    IRExpr *arg2 ;
942 };   942 };
943 struct __anonstruct_Unop_24 {   943 struct __anonstruct_Unop_24 {
944    IROp op ;   944    IROp op ;
945    IRExpr *arg ;   945    IRExpr *arg ;
946 };   946 };
947 struct __anonstruct_Load_25 {   947 struct __anonstruct_Load_25 {
948    IREndness end ;   948    IREndness end ;
949    IRType ty ;   949    IRType ty ;
950    IRExpr *addr ;   950    IRExpr *addr ;
951 };   951 };
952 struct __anonstruct_Const_26 {   952 struct __anonstruct_Const_26 {
953    IRConst *con ;   953    IRConst *con ;
954 };   954 };
955 struct __anonstruct_CCall_27 {   955 struct __anonstruct_CCall_27 {
956    IRCallee *cee ;   956    IRCallee *cee ;
957    IRType retty ;   957    IRType retty ;
958    IRExpr **args ;   958    IRExpr **args ;
959 };   959 };
960 struct __anonstruct_Mux0X_28 {   960 struct __anonstruct_Mux0X_28 {
961    IRExpr *cond ;   961    IRExpr *cond ;
962    IRExpr *expr0 ;   962    IRExpr *expr0 ;
963    IRExpr *exprX ;   963    IRExpr *exprX ;
964 };   964 };
965 union __anonunion_Iex_16 {   965 union __anonunion_Iex_16 {
966    struct __anonstruct_Binder_17 Binder ;   966    struct __anonstruct_Binder_17 Binder ;
967    struct __anonstruct_Get_18 Get ;   967    struct __anonstruct_Get_18 Get ;
968    struct __anonstruct_GetI_19 GetI ;   968    struct __anonstruct_GetI_19 GetI ;
969    struct __anonstruct_RdTmp_20 RdTmp ;   969    struct __anonstruct_RdTmp_20 RdTmp ;
970    struct __anonstruct_Qop_21 Qop ;   970    struct __anonstruct_Qop_21 Qop ;
971    struct __anonstruct_Triop_22 Triop ;   971    struct __anonstruct_Triop_22 Triop ;
972    struct __anonstruct_Binop_23 Binop ;   972    struct __anonstruct_Binop_23 Binop ;
973    struct __anonstruct_Unop_24 Unop ;   973    struct __anonstruct_Unop_24 Unop ;
974    struct __anonstruct_Load_25 Load ;   974    struct __anonstruct_Load_25 Load ;
975    struct __anonstruct_Const_26 Const ;   975    struct __anonstruct_Const_26 Const ;
976    struct __anonstruct_CCall_27 CCall ;   976    struct __anonstruct_CCall_27 CCall ;
977    struct __anonstruct_Mux0X_28 Mux0X ;   977    struct __anonstruct_Mux0X_28 Mux0X ;
978 };   978 };
979 struct _IRExpr {   979 struct _IRExpr {
980    IRExprTag tag ;   980    IRExprTag tag ;
981    union __anonunion_Iex_16 Iex ;   981    union __anonunion_Iex_16 Iex ;
982 };   982 };
983 enum __anonenum_IRJumpKind_29 {   983 enum __anonenum_IRJumpKind_29 {
984     Ijk_Boring = 90112,   984     Ijk_Boring = 90112,
985     Ijk_Call = 90113,   985     Ijk_Call = 90113,
986     Ijk_Ret = 90114,   986     Ijk_Ret = 90114,
987     Ijk_ClientReq = 90115,   987     Ijk_ClientReq = 90115,
988     Ijk_Yield = 90116,   988     Ijk_Yield = 90116,
989     Ijk_EmWarn = 90117,   989     Ijk_EmWarn = 90117,
990     Ijk_EmFail = 90118,   990     Ijk_EmFail = 90118,
991     Ijk_NoDecode = 90119,   991     Ijk_NoDecode = 90119,
992     Ijk_MapFail = 90120,   992     Ijk_MapFail = 90120,
993     Ijk_TInval = 90121,   993     Ijk_TInval = 90121,
994     Ijk_NoRedir = 90122,   994     Ijk_NoRedir = 90122,
995     Ijk_SigTRAP = 90123,   995     Ijk_SigTRAP = 90123,
996     Ijk_SigSEGV = 90124,   996     Ijk_SigSEGV = 90124,
997     Ijk_SigBUS = 90125,   997     Ijk_SigBUS = 90125,
998     Ijk_Sys_syscall = 90126,   998     Ijk_Sys_syscall = 90126,
999     Ijk_Sys_int32 = 90127,   999     Ijk_Sys_int32 = 90127,
1000     Ijk_Sys_int128 = 90128,   1000     Ijk_Sys_int128 = 90128,
1001     Ijk_Sys_int129 = 90129,   1001     Ijk_Sys_int129 = 90129,
1002     Ijk_Sys_int130 = 90130,   1002     Ijk_Sys_int130 = 90130,
1003     Ijk_Sys_sysenter = 90131   1003     Ijk_Sys_sysenter = 90131
1004 } ;   1004 } ;
1005 typedef enum __anonenum_IRJumpKind_29 IRJumpKind;   1005 typedef enum __anonenum_IRJumpKind_29 IRJumpKind;
1006 enum __anonenum_IREffect_30 {   1006 enum __anonenum_IREffect_30 {
1007     Ifx_None = 94208,   1007     Ifx_None = 94208,
1008     Ifx_Read = 94209,   1008     Ifx_Read = 94209,
1009     Ifx_Write = 94210,   1009     Ifx_Write = 94210,
1010     Ifx_Modify = 94211   1010     Ifx_Modify = 94211
1011 } ;   1011 } ;
1012 typedef enum __anonenum_IREffect_30 IREffect;   1012 typedef enum __anonenum_IREffect_30 IREffect;
1013 struct __anonstruct_fxState_32 {   1013 struct __anonstruct_fxState_32 {
1014    IREffect fx ;   1014    IREffect fx ;
1015    Int offset ;   1015    Int offset ;
1016    Int size ;   1016    Int size ;
1017 };   1017 };
1018 struct __anonstruct_IRDirty_31 {   1018 struct __anonstruct_IRDirty_31 {
1019    IRCallee *cee ;   1019    IRCallee *cee ;
1020    IRExpr *guard ;   1020    IRExpr *guard ;
1021    IRExpr **args ;   1021    IRExpr **args ;
1022    IRTemp tmp ;   1022    IRTemp tmp ;
1023    IREffect mFx ;   1023    IREffect mFx ;
1024    IRExpr *mAddr ;   1024    IRExpr *mAddr ;
1025    Int mSize ;   1025    Int mSize ;
1026    Bool needsBBP ;   1026    Bool needsBBP ;
1027    Int nFxState ;   1027    Int nFxState ;
1028    struct __anonstruct_fxState_32 fxState[7] ;   1028    struct __anonstruct_fxState_32 fxState[7] ;
1029 };   1029 };
1030 typedef struct __anonstruct_IRDirty_31 IRDirty;   1030 typedef struct __anonstruct_IRDirty_31 IRDirty;
1031 enum __anonenum_IRMBusEvent_33 {   1031 enum __anonenum_IRMBusEvent_33 {
1032     Imbe_Fence = 98304   1032     Imbe_Fence = 98304
1033 } ;   1033 } ;
1034 typedef enum __anonenum_IRMBusEvent_33 IRMBusEvent;   1034 typedef enum __anonenum_IRMBusEvent_33 IRMBusEvent;
1035 struct __anonstruct_IRCAS_34 {   1035 struct __anonstruct_IRCAS_34 {
1036    IRTemp oldHi ;   1036    IRTemp oldHi ;
1037    IRTemp oldLo ;   1037    IRTemp oldLo ;
1038    IREndness end ;   1038    IREndness end ;
1039    IRExpr *addr ;   1039    IRExpr *addr ;
1040    IRExpr *expdHi ;   1040    IRExpr *expdHi ;
1041    IRExpr *expdLo ;   1041    IRExpr *expdLo ;
1042    IRExpr *dataHi ;   1042    IRExpr *dataHi ;
1043    IRExpr *dataLo ;   1043    IRExpr *dataLo ;
1044 };   1044 };
1045 typedef struct __anonstruct_IRCAS_34 IRCAS;   1045 typedef struct __anonstruct_IRCAS_34 IRCAS;
1046 enum __anonenum_IRStmtTag_35 {   1046 enum __anonenum_IRStmtTag_35 {
1047     Ist_NoOp = 102400,   1047     Ist_NoOp = 102400,
1048     Ist_IMark = 102401,   1048     Ist_IMark = 102401,
1049     Ist_AbiHint = 102402,   1049     Ist_AbiHint = 102402,
1050     Ist_Put = 102403,   1050     Ist_Put = 102403,
1051     Ist_PutI = 102404,   1051     Ist_PutI = 102404,
1052     Ist_WrTmp = 102405,   1052     Ist_WrTmp = 102405,
1053     Ist_Store = 102406,   1053     Ist_Store = 102406,
1054     Ist_CAS = 102407,   1054     Ist_CAS = 102407,
1055     Ist_LLSC = 102408,   1055     Ist_LLSC = 102408,
1056     Ist_Dirty = 102409,   1056     Ist_Dirty = 102409,
1057     Ist_MBE = 102410,   1057     Ist_MBE = 102410,
1058     Ist_Exit = 102411   1058     Ist_Exit = 102411
1059 } ;   1059 } ;
1060 typedef enum __anonenum_IRStmtTag_35 IRStmtTag;   1060 typedef enum __anonenum_IRStmtTag_35 IRStmtTag;
1061 struct __anonstruct_NoOp_37 {   1061 struct __anonstruct_NoOp_37 {
1062     1062  
1063 };   1063 };
1064 struct __anonstruct_IMark_38 {   1064 struct __anonstruct_IMark_38 {
1065    Addr64 addr ;   1065    Addr64 addr ;
1066    Int len ;   1066    Int len ;
1067 };   1067 };
1068 struct __anonstruct_AbiHint_39 {   1068 struct __anonstruct_AbiHint_39 {
1069    IRExpr *base ;   1069    IRExpr *base ;
1070    Int len ;   1070    Int len ;
1071    IRExpr *nia ;   1071    IRExpr *nia ;
1072 };   1072 };
1073 struct __anonstruct_Put_40 {   1073 struct __anonstruct_Put_40 {
1074    Int offset ;   1074    Int offset ;
1075    IRExpr *data ;   1075    IRExpr *data ;
1076 };   1076 };
1077 struct __anonstruct_PutI_41 {   1077 struct __anonstruct_PutI_41 {
1078    IRRegArray *descr ;   1078    IRRegArray *descr ;
1079    IRExpr *ix ;   1079    IRExpr *ix ;
1080    Int bias ;   1080    Int bias ;
1081    IRExpr *data ;   1081    IRExpr *data ;
1082 };   1082 };
1083 struct __anonstruct_WrTmp_42 {   1083 struct __anonstruct_WrTmp_42 {
1084    IRTemp tmp ;   1084    IRTemp tmp ;
1085    IRExpr *data ;   1085    IRExpr *data ;
1086 };   1086 };
1087 struct __anonstruct_Store_43 {   1087 struct __anonstruct_Store_43 {
1088    IREndness end ;   1088    IREndness end ;
1089    IRExpr *addr ;   1089    IRExpr *addr ;
1090    IRExpr *data ;   1090    IRExpr *data ;
1091 };   1091 };
1092 struct __anonstruct_CAS_44 {   1092 struct __anonstruct_CAS_44 {
1093    IRCAS *details ;   1093    IRCAS *details ;
1094 };   1094 };
1095 struct __anonstruct_LLSC_45 {   1095 struct __anonstruct_LLSC_45 {
1096    IREndness end ;   1096    IREndness end ;
1097    IRTemp result ;   1097    IRTemp result ;
1098    IRExpr *addr ;   1098    IRExpr *addr ;
1099    IRExpr *storedata ;   1099    IRExpr *storedata ;
1100 };   1100 };
1101 struct __anonstruct_Dirty_46 {   1101 struct __anonstruct_Dirty_46 {
1102    IRDirty *details ;   1102    IRDirty *details ;
1103 };   1103 };
1104 struct __anonstruct_MBE_47 {   1104 struct __anonstruct_MBE_47 {
1105    IRMBusEvent event ;   1105    IRMBusEvent event ;
1106 };   1106 };
1107 struct __anonstruct_Exit_48 {   1107 struct __anonstruct_Exit_48 {
1108    IRExpr *guard ;   1108    IRExpr *guard ;
1109    IRJumpKind jk ;   1109    IRJumpKind jk ;
1110    IRConst *dst ;   1110    IRConst *dst ;
1111 };   1111 };
1112 union __anonunion_Ist_36 {   1112 union __anonunion_Ist_36 {
1113    struct __anonstruct_NoOp_37 NoOp ;   1113    struct __anonstruct_NoOp_37 NoOp ;
1114    struct __anonstruct_IMark_38 IMark ;   1114    struct __anonstruct_IMark_38 IMark ;
1115    struct __anonstruct_AbiHint_39 AbiHint ;   1115    struct __anonstruct_AbiHint_39 AbiHint ;
1116    struct __anonstruct_Put_40 Put ;   1116    struct __anonstruct_Put_40 Put ;
1117    struct __anonstruct_PutI_41 PutI ;   1117    struct __anonstruct_PutI_41 PutI ;
1118    struct __anonstruct_WrTmp_42 WrTmp ;   1118    struct __anonstruct_WrTmp_42 WrTmp ;
1119    struct __anonstruct_Store_43 Store ;   1119    struct __anonstruct_Store_43 Store ;
1120    struct __anonstruct_CAS_44 CAS ;   1120    struct __anonstruct_CAS_44 CAS ;
1121    struct __anonstruct_LLSC_45 LLSC ;   1121    struct __anonstruct_LLSC_45 LLSC ;
1122    struct __anonstruct_Dirty_46 Dirty ;   1122    struct __anonstruct_Dirty_46 Dirty ;
1123    struct __anonstruct_MBE_47 MBE ;   1123    struct __anonstruct_MBE_47 MBE ;
1124    struct __anonstruct_Exit_48 Exit ;   1124    struct __anonstruct_Exit_48 Exit ;
1125 };   1125 };
1126 struct _IRStmt {   1126 struct _IRStmt {
1127    IRStmtTag tag ;   1127    IRStmtTag tag ;
1128    union __anonunion_Ist_36 Ist ;   1128    union __anonunion_Ist_36 Ist ;
1129 };   1129 };
1130 typedef struct _IRStmt IRStmt;   1130 typedef struct _IRStmt IRStmt;
1131 struct __anonstruct_IRTypeEnv_49 {   1131 struct __anonstruct_IRTypeEnv_49 {
1132    IRType *types ;   1132    IRType *types ;
1133    Int types_size ;   1133    Int types_size ;
1134    Int types_used ;   1134    Int types_used ;
1135 };   1135 };
1136 typedef struct __anonstruct_IRTypeEnv_49 IRTypeEnv;   1136 typedef struct __anonstruct_IRTypeEnv_49 IRTypeEnv;
1137 struct __anonstruct_IRSB_50 {   1137 struct __anonstruct_IRSB_50 {
1138    IRTypeEnv *tyenv ;   1138    IRTypeEnv *tyenv ;
1139    IRStmt **stmts ;   1139    IRStmt **stmts ;
1140    Int stmts_size ;   1140    Int stmts_size ;
1141    Int stmts_used ;   1141    Int stmts_used ;
1142    IRExpr *next ;   1142    IRExpr *next ;
1143    IRJumpKind jumpkind ;   1143    IRJumpKind jumpkind ;
1144 };   1144 };
1145 typedef struct __anonstruct_IRSB_50 IRSB;   1145 typedef struct __anonstruct_IRSB_50 IRSB;
1146 enum __anonenum_VexArch_51 {   1146 enum __anonenum_VexArch_51 {
1147     VexArch_INVALID = 0,   1147     VexArch_INVALID = 0,
1148     VexArchX86 = 1,   1148     VexArchX86 = 1,
1149     VexArchAMD64 = 2,   1149     VexArchAMD64 = 2,
1150     VexArchARM = 3,   1150     VexArchARM = 3,
1151     VexArchPPC32 = 4,   1151     VexArchPPC32 = 4,
1152     VexArchPPC64 = 5,   1152     VexArchPPC64 = 5,
1153     VexArchS390X = 6   1153     VexArchS390X = 6
1154 } ;   1154 } ;
1155 typedef enum __anonenum_VexArch_51 VexArch;   1155 typedef enum __anonenum_VexArch_51 VexArch;
1156 struct __anonstruct_VexArchInfo_52 {   1156 struct __anonstruct_VexArchInfo_52 {
1157    UInt hwcaps ;   1157    UInt hwcaps ;
1158    Int ppc_cache_line_szB ;   1158    Int ppc_cache_line_szB ;
1159    UInt ppc_dcbz_szB ;   1159    UInt ppc_dcbz_szB ;
1160    UInt ppc_dcbzl_szB ;   1160    UInt ppc_dcbzl_szB ;
1161 };   1161 };
1162 typedef struct __anonstruct_VexArchInfo_52 VexArchInfo;   1162 typedef struct __anonstruct_VexArchInfo_52 VexArchInfo;
1163 struct __anonstruct_VexAbiInfo_53 {   1163 struct __anonstruct_VexAbiInfo_53 {
1164    Int guest_stack_redzone_size ;   1164    Int guest_stack_redzone_size ;
1165    Bool guest_amd64_assume_fs_is_zero ;   1165    Bool guest_amd64_assume_fs_is_zero ;
1166    Bool guest_amd64_assume_gs_is_0x60 ;   1166    Bool guest_amd64_assume_gs_is_0x60 ;
1167    Bool guest_ppc_zap_RZ_at_blr ;   1167    Bool guest_ppc_zap_RZ_at_blr ;
1168    Bool (*guest_ppc_zap_RZ_at_bl)(Addr64  ) ;   1168    Bool (*guest_ppc_zap_RZ_at_bl)(Addr64  ) ;
1169    Bool guest_ppc_sc_continues_at_LR ;   1169    Bool guest_ppc_sc_continues_at_LR ;
1170    Bool host_ppc_calls_use_fndescrs ;   1170    Bool host_ppc_calls_use_fndescrs ;
1171    Bool host_ppc32_regalign_int64_args ;   1171    Bool host_ppc32_regalign_int64_args ;
1172 };   1172 };
1173 typedef struct __anonstruct_VexAbiInfo_53 VexAbiInfo;   1173 typedef struct __anonstruct_VexAbiInfo_53 VexAbiInfo;
1174 struct __anonstruct_VexControl_54 {   1174 struct __anonstruct_VexControl_54 {
1175    Int iropt_verbosity ;   1175    Int iropt_verbosity ;
1176    Int iropt_level ;   1176    Int iropt_level ;
1177    Bool iropt_precise_memory_exns ;   1177    Bool iropt_precise_memory_exns ;
1178    Int iropt_unroll_thresh ;   1178    Int iropt_unroll_thresh ;
1179    Int guest_max_insns ;   1179    Int guest_max_insns ;
1180    Int guest_chase_thresh ;   1180    Int guest_chase_thresh ;
1181    Bool guest_chase_cond ;   1181    Bool guest_chase_cond ;
1182 };   1182 };
1183 typedef struct __anonstruct_VexControl_54 VexControl;   1183 typedef struct __anonstruct_VexControl_54 VexControl;
1184 struct __anonstruct_alwaysDefd_56 {   1184 struct __anonstruct_alwaysDefd_56 {
1185    Int offset ;   1185    Int offset ;
1186    Int size ;   1186    Int size ;
1187 };   1187 };
1188 struct __anonstruct_VexGuestLayout_55 {   1188 struct __anonstruct_VexGuestLayout_55 {
1189    Int total_sizeB ;   1189    Int total_sizeB ;
1190    Int offset_SP ;   1190    Int offset_SP ;
1191    Int sizeof_SP ;   1191    Int sizeof_SP ;
1192    Int offset_FP ;   1192    Int offset_FP ;
1193    Int sizeof_FP ;   1193    Int sizeof_FP ;
1194    Int offset_IP ;   1194    Int offset_IP ;
1195    Int sizeof_IP ;   1195    Int sizeof_IP ;
1196    Int n_alwaysDefd ;   1196    Int n_alwaysDefd ;
1197    struct __anonstruct_alwaysDefd_56 alwaysDefd[24] ;   1197    struct __anonstruct_alwaysDefd_56 alwaysDefd[24] ;
1198 };   1198 };
1199 typedef struct __anonstruct_VexGuestLayout_55 VexGuestLayout;   1199 typedef struct __anonstruct_VexGuestLayout_55 VexGuestLayout;
1200 enum __anonenum_VexTranslateResult_57 {   1200 enum __anonenum_VexTranslateResult_57 {
1201     VexTransOK = 0,   1201     VexTransOK = 0,
1202     VexTransAccessFail = 1,   1202     VexTransAccessFail = 1,
1203     VexTransOutputFull = 2   1203     VexTransOutputFull = 2
1204 } ;   1204 } ;
1205 typedef enum __anonenum_VexTranslateResult_57 VexTranslateResult;   1205 typedef enum __anonenum_VexTranslateResult_57 VexTranslateResult;
1206 struct __anonstruct_VexGuestExtents_58 {   1206 struct __anonstruct_VexGuestExtents_58 {
1207    Addr64 base[3] ;   1207    Addr64 base[3] ;
1208    UShort len[3] ;   1208    UShort len[3] ;
1209    UShort n_used ;   1209    UShort n_used ;
1210 };   1210 };
1211 typedef struct __anonstruct_VexGuestExtents_58 VexGuestExtents;   1211 typedef struct __anonstruct_VexGuestExtents_58 VexGuestExtents;
1212 struct __anonstruct_VexTranslateArgs_59 {   1212 struct __anonstruct_VexTranslateArgs_59 {
1213    VexArch arch_guest ;   1213    VexArch arch_guest ;
1214    VexArchInfo archinfo_guest ;   1214    VexArchInfo archinfo_guest ;
1215    VexArch arch_host ;   1215    VexArch arch_host ;
1216    VexArchInfo archinfo_host ;   1216    VexArchInfo archinfo_host ;
1217    VexAbiInfo abiinfo_both ;   1217    VexAbiInfo abiinfo_both ;
1218    void *callback_opaque ;   1218    void *callback_opaque ;
1219    UChar *guest_bytes ;   1219    UChar *guest_bytes ;
1220    Addr64 guest_bytes_addr ;   1220    Addr64 guest_bytes_addr ;
1221    Bool (*chase_into_ok)(void * , Addr64  ) ;   1221    Bool (*chase_into_ok)(void * , Addr64  ) ;
1222    VexGuestExtents *guest_extents ;   1222    VexGuestExtents *guest_extents ;
1223    UChar *host_bytes ;   1223    UChar *host_bytes ;
1224    Int host_bytes_size ;   1224    Int host_bytes_size ;
1225    Int *host_bytes_used ;   1225    Int *host_bytes_used ;
1226    IRSB *(*instrument1)(void * , IRSB * , VexGuestLayout * , VexGuestExtents * ,   1226    IRSB *(*instrument1)(void * , IRSB * , VexGuestLayout * , VexGuestExtents * ,
1227                         IRType gWordTy , IRType hWordTy ) ;   1227                         IRType gWordTy , IRType hWordTy ) ;
1228    IRSB *(*instrument2)(void * , IRSB * , VexGuestLayout * , VexGuestExtents * ,   1228    IRSB *(*instrument2)(void * , IRSB * , VexGuestLayout * , VexGuestExtents * ,
1229                         IRType gWordTy , IRType hWordTy ) ;   1229                         IRType gWordTy , IRType hWordTy ) ;
1230    IRSB *(*finaltidy)(IRSB * ) ;   1230    IRSB *(*finaltidy)(IRSB * ) ;
1231    Bool do_self_check ;   1231    Bool do_self_check ;
1232    Bool (*preamble_function)(void * , IRSB * ) ;   1232    Bool (*preamble_function)(void * , IRSB * ) ;
1233    Int traceflags ;   1233    Int traceflags ;
1234    void *dispatch ;   1234    void *dispatch ;
1235 };   1235 };
1236 typedef struct __anonstruct_VexTranslateArgs_59 VexTranslateArgs;   1236 typedef struct __anonstruct_VexTranslateArgs_59 VexTranslateArgs;
1237 struct __anonstruct_VgCallbackClosure_60 {   1237 struct __anonstruct_VgCallbackClosure_60 {
1238    Addr64 nraddr ;   1238    Addr64 nraddr ;
1239    Addr64 readdr ;   1239    Addr64 readdr ;
1240    ThreadId tid ;   1240    ThreadId tid ;
1241 };   1241 };
1242 typedef struct __anonstruct_VgCallbackClosure_60 VgCallbackClosure;   1242 typedef struct __anonstruct_VgCallbackClosure_60 VgCallbackClosure;
1243 enum __anonenum_CorePart_61 {   1243 enum __anonenum_CorePart_61 {
1244     Vg_CoreStartup = 1,   1244     Vg_CoreStartup = 1,
1245     Vg_CoreSignal = 2,   1245     Vg_CoreSignal = 2,
1246     Vg_CoreSysCall = 3,   1246     Vg_CoreSysCall = 3,
1247     Vg_CoreSysCallArgInMem = 4,   1247     Vg_CoreSysCallArgInMem = 4,
1248     Vg_CoreTranslate = 5,   1248     Vg_CoreTranslate = 5,
1249     Vg_CoreClientReq = 6   1249     Vg_CoreClientReq = 6
1250 } ;   1250 } ;
1251 typedef enum __anonenum_CorePart_61 CorePart;   1251 typedef enum __anonenum_CorePart_61 CorePart;
1252 struct _VgHashNode {   1252 struct _VgHashNode {
1253    struct _VgHashNode *next ;   1253    struct _VgHashNode *next ;
1254    UWord key ;   1254    UWord key ;
1255 };   1255 };
1256 typedef struct _VgHashNode VgHashNode;   1256 typedef struct _VgHashNode VgHashNode;
1257 struct _VgHashTable;   1257 struct _VgHashTable;
1258 typedef struct _VgHashTable *VgHashTable;   1258 typedef struct _VgHashTable *VgHashTable;
1259 struct _XArray;   1259 struct _XArray;
1260 typedef struct _XArray XArray;   1260 typedef struct _XArray XArray;
1261 typedef Addr *StackTrace;   1261 typedef Addr *StackTrace;
1262 struct _WordFM;   1262 struct _WordFM;
1263 typedef struct _WordFM WordFM;   1263 typedef struct _WordFM WordFM;
1264 struct _WordBag;   1264 struct _WordBag;
1265 typedef struct _WordBag WordBag;   1265 typedef struct _WordBag WordBag;
1266 enum __anonenum_Vg_FnNameKind_62 {   1266 enum __anonenum_Vg_FnNameKind_62 {
1267     Vg_FnNameNormal = 0,   1267     Vg_FnNameNormal = 0,
1268     Vg_FnNameMain = 1,   1268     Vg_FnNameMain = 1,
1269     Vg_FnNameBelowMain = 2   1269     Vg_FnNameBelowMain = 2
1270 } ;   1270 } ;
1271 typedef enum __anonenum_Vg_FnNameKind_62 Vg_FnNameKind;   1271 typedef enum __anonenum_Vg_FnNameKind_62 Vg_FnNameKind;
1272 struct __anonstruct_StackBlock_63 {   1272 struct __anonstruct_StackBlock_63 {
1273    PtrdiffT base ;   1273    PtrdiffT base ;
1274    SizeT szB ;   1274    SizeT szB ;
1275    Bool spRel ;   1275    Bool spRel ;
1276    Bool isVec ;   1276    Bool isVec ;
1277    HChar name[16] ;   1277    HChar name[16] ;
1278 };   1278 };
1279 typedef struct __anonstruct_StackBlock_63 StackBlock;   1279 typedef struct __anonstruct_StackBlock_63 StackBlock;
1280 struct __anonstruct_GlobalBlock_64 {   1280 struct __anonstruct_GlobalBlock_64 {
1281    Addr addr ;   1281    Addr addr ;
1282    SizeT szB ;   1282    SizeT szB ;
1283    Bool isVec ;   1283    Bool isVec ;
1284    HChar name[16] ;   1284    HChar name[16] ;
1285    HChar soname[16] ;   1285    HChar soname[16] ;
1286 };   1286 };
1287 typedef struct __anonstruct_GlobalBlock_64 GlobalBlock;   1287 typedef struct __anonstruct_GlobalBlock_64 GlobalBlock;
1288 struct _DebugInfo;   1288 struct _DebugInfo;
1289 typedef struct _DebugInfo DebugInfo;   1289 typedef struct _DebugInfo DebugInfo;
1290 enum __anonenum_VgSectKind_65 {   1290 enum __anonenum_VgSectKind_65 {
1291     Vg_SectUnknown = 0,   1291     Vg_SectUnknown = 0,
1292     Vg_SectText = 1,   1292     Vg_SectText = 1,
1293     Vg_SectData = 2,   1293     Vg_SectData = 2,
1294     Vg_SectBSS = 3,   1294     Vg_SectBSS = 3,
1295     Vg_SectGOT = 4,   1295     Vg_SectGOT = 4,
1296     Vg_SectPLT = 5,   1296     Vg_SectPLT = 5,
1297     Vg_SectGOTPLT = 6,   1297     Vg_SectGOTPLT = 6,
1298     Vg_SectOPD = 7   1298     Vg_SectOPD = 7
1299 } ;   1299 } ;
1300 typedef enum __anonenum_VgSectKind_65 VgSectKind;   1300 typedef enum __anonenum_VgSectKind_65 VgSectKind;
1301 typedef unsigned short __vki_kernel_mode_t;   1301 typedef unsigned short __vki_kernel_mode_t;
1302 typedef long __vki_kernel_off_t;   1302 typedef long __vki_kernel_off_t;
1303 typedef int __vki_kernel_pid_t;   1303 typedef int __vki_kernel_pid_t;
1304 typedef unsigned short __vki_kernel_ipc_pid_t;   1304 typedef unsigned short __vki_kernel_ipc_pid_t;
1305 typedef unsigned short __vki_kernel_uid_t;   1305 typedef unsigned short __vki_kernel_uid_t;
1306 typedef unsigned short __vki_kernel_gid_t;   1306 typedef unsigned short __vki_kernel_gid_t;
1307 typedef unsigned int __vki_kernel_size_t;   1307 typedef unsigned int __vki_kernel_size_t;
1308 typedef long __vki_kernel_time_t;   1308 typedef long __vki_kernel_time_t;
1309 typedef long __vki_kernel_suseconds_t;   1309 typedef long __vki_kernel_suseconds_t;
1310 typedef long __vki_kernel_clock_t;   1310 typedef long __vki_kernel_clock_t;
1311 typedef int __vki_kernel_timer_t;   1311 typedef int __vki_kernel_timer_t;
1312 typedef int __vki_kernel_clockid_t;   1312 typedef int __vki_kernel_clockid_t;
1313 typedef char *__vki_kernel_caddr_t;   1313 typedef char *__vki_kernel_caddr_t;
1314 typedef unsigned int __vki_kernel_uid32_t;   1314 typedef unsigned int __vki_kernel_uid32_t;
1315 typedef unsigned int __vki_kernel_gid32_t;   1315 typedef unsigned int __vki_kernel_gid32_t;
1316 typedef unsigned short __vki_kernel_old_uid_t;   1316 typedef unsigned short __vki_kernel_old_uid_t;
1317 typedef unsigned short __vki_kernel_old_gid_t;   1317 typedef unsigned short __vki_kernel_old_gid_t;
1318 typedef long long __vki_kernel_loff_t;   1318 typedef long long __vki_kernel_loff_t;
1319 struct __anonstruct___vki_kernel_fsid_t_66 {   1319 struct __anonstruct___vki_kernel_fsid_t_66 {
1320    int val[2] ;   1320    int val[2] ;
1321 };   1321 };
1322 typedef struct __anonstruct___vki_kernel_fsid_t_66 __vki_kernel_fsid_t;   1322 typedef struct __anonstruct___vki_kernel_fsid_t_66 __vki_kernel_fsid_t;
1323 struct __anonstruct___vki_kernel_fd_set_67 {   1323 struct __anonstruct___vki_kernel_fd_set_67 {
1324    unsigned long fds_bits[1024U / (8U * sizeof(unsigned long ))] ;   1324    unsigned long fds_bits[1024U / (8U * sizeof(unsigned long ))] ;
1325 };   1325 };
1326 typedef struct __anonstruct___vki_kernel_fd_set_67 __vki_kernel_fd_set;   1326 typedef struct __anonstruct___vki_kernel_fd_set_67 __vki_kernel_fd_set;
1327 typedef int __vki_kernel_key_t;   1327 typedef int __vki_kernel_key_t;
1328 typedef int __vki_kernel_mqd_t;   1328 typedef int __vki_kernel_mqd_t;
1329 typedef __vki_kernel_fd_set vki_fd_set;   1329 typedef __vki_kernel_fd_set vki_fd_set;
1330 typedef __vki_kernel_mode_t vki_mode_t;   1330 typedef __vki_kernel_mode_t vki_mode_t;
1331 typedef __vki_kernel_off_t vki_off_t;   1331 typedef __vki_kernel_off_t vki_off_t;
1332 typedef __vki_kernel_pid_t vki_pid_t;   1332 typedef __vki_kernel_pid_t vki_pid_t;
1333 typedef __vki_kernel_key_t vki_key_t;   1333 typedef __vki_kernel_key_t vki_key_t;
1334 typedef __vki_kernel_suseconds_t vki_suseconds_t;   1334 typedef __vki_kernel_suseconds_t vki_suseconds_t;
1335 typedef __vki_kernel_timer_t vki_timer_t;   1335 typedef __vki_kernel_timer_t vki_timer_t;
1336 typedef __vki_kernel_clockid_t vki_clockid_t;   1336 typedef __vki_kernel_clockid_t vki_clockid_t;
1337 typedef __vki_kernel_mqd_t vki_mqd_t;   1337 typedef __vki_kernel_mqd_t vki_mqd_t;
1338 typedef __vki_kernel_uid32_t vki_uid_t;   1338 typedef __vki_kernel_uid32_t vki_uid_t;
1339 typedef __vki_kernel_gid32_t vki_gid_t;   1339 typedef __vki_kernel_gid32_t vki_gid_t;
1340 typedef __vki_kernel_old_uid_t vki_old_uid_t;   1340 typedef __vki_kernel_old_uid_t vki_old_uid_t;
1341 typedef __vki_kernel_old_gid_t vki_old_gid_t;   1341 typedef __vki_kernel_old_gid_t vki_old_gid_t;
1342 typedef __vki_kernel_loff_t vki_loff_t;   1342 typedef __vki_kernel_loff_t vki_loff_t;
1343 typedef __vki_kernel_size_t vki_size_t;   1343 typedef __vki_kernel_size_t vki_size_t;
1344 typedef __vki_kernel_time_t vki_time_t;   1344 typedef __vki_kernel_time_t vki_time_t;
1345 typedef __vki_kernel_clock_t vki_clock_t;   1345 typedef __vki_kernel_clock_t vki_clock_t;
1346 typedef __vki_kernel_caddr_t vki_caddr_t;   1346 typedef __vki_kernel_caddr_t vki_caddr_t;
1347 typedef unsigned long vki_u_long;   1347 typedef unsigned long vki_u_long;
1348 typedef unsigned int vki_uint;   1348 typedef unsigned int vki_uint;
1349 typedef unsigned char __vki_u8;   1349 typedef unsigned char __vki_u8;
1350 typedef short __vki_s16;   1350 typedef short __vki_s16;
1351 typedef unsigned short __vki_u16;   1351 typedef unsigned short __vki_u16;
1352 typedef int __vki_s32;   1352 typedef int __vki_s32;
1353 typedef unsigned int __vki_u32;   1353 typedef unsigned int __vki_u32;
1354 typedef long long __vki_s64;   1354 typedef long long __vki_s64;
1355 typedef unsigned long long __vki_u64;   1355 typedef unsigned long long __vki_u64;
1356 typedef unsigned short vki_u16;   1356 typedef unsigned short vki_u16;
1357 typedef unsigned int vki_u32;   1357 typedef unsigned int vki_u32;
1358 typedef void __vki_signalfn_t(int  );   1358 typedef void __vki_signalfn_t(int  );
1359 typedef __vki_signalfn_t *__vki_sighandler_t;   1359 typedef __vki_signalfn_t *__vki_sighandler_t;
1360 typedef void __vki_restorefn_t(void);   1360 typedef void __vki_restorefn_t(void);
1361 typedef __vki_restorefn_t *__vki_sigrestore_t;   1361 typedef __vki_restorefn_t *__vki_sigrestore_t;
1362 typedef unsigned long vki_old_sigset_t;   1362 typedef unsigned long vki_old_sigset_t;
1363 struct __anonstruct_vki_sigset_t_68 {   1363 struct __anonstruct_vki_sigset_t_68 {
1364    unsigned long sig[2] ;   1364    unsigned long sig[2] ;
1365 };   1365 };
1366 typedef struct __anonstruct_vki_sigset_t_68 vki_sigset_t;   1366 typedef struct __anonstruct_vki_sigset_t_68 vki_sigset_t;
1367 struct vki_old_sigaction {   1367 struct vki_old_sigaction {
1368    __vki_sighandler_t ksa_handler ;   1368    __vki_sighandler_t ksa_handler ;
1369    vki_old_sigset_t sa_mask ;   1369    vki_old_sigset_t sa_mask ;
1370    unsigned long sa_flags ;   1370    unsigned long sa_flags ;
1371    __vki_sigrestore_t sa_restorer ;   1371    __vki_sigrestore_t sa_restorer ;
1372 };   1372 };
1373 struct vki_sigaction_base {   1373 struct vki_sigaction_base {
1374    __vki_sighandler_t ksa_handler ;   1374    __vki_sighandler_t ksa_handler ;
1375    unsigned long sa_flags ;   1375    unsigned long sa_flags ;
1376    __vki_sigrestore_t sa_restorer ;   1376    __vki_sigrestore_t sa_restorer ;
1377    vki_sigset_t sa_mask ;   1377    vki_sigset_t sa_mask ;
1378 };   1378 };
1379 typedef struct vki_sigaction_base vki_sigaction_toK_t;   1379 typedef struct vki_sigaction_base vki_sigaction_toK_t;
1380 typedef struct vki_sigaction_base vki_sigaction_fromK_t;   1380 typedef struct vki_sigaction_base vki_sigaction_fromK_t;
1381 struct vki_sigaltstack {   1381 struct vki_sigaltstack {
1382    void *ss_sp ;   1382    void *ss_sp ;
1383    int ss_flags ;   1383    int ss_flags ;
1384    vki_size_t ss_size ;   1384    vki_size_t ss_size ;
1385 };   1385 };
1386 typedef struct vki_sigaltstack vki_stack_t;   1386 typedef struct vki_sigaltstack vki_stack_t;
1387 struct _vki_fpreg {   1387 struct _vki_fpreg {
1388    unsigned short significand[4] ;   1388    unsigned short significand[4] ;
1389    unsigned short exponent ;   1389    unsigned short exponent ;
1390 };   1390 };
1391 struct _vki_fpxreg {   1391 struct _vki_fpxreg {
1392    unsigned short significand[4] ;   1392    unsigned short significand[4] ;
1393    unsigned short exponent ;   1393    unsigned short exponent ;
1394    unsigned short padding[3] ;   1394    unsigned short padding[3] ;
1395 };   1395 };
1396 struct _vki_xmmreg {   1396 struct _vki_xmmreg {
1397    unsigned long element[4] ;   1397    unsigned long element[4] ;
1398 };   1398 };
1399 struct _vki_fpstate {   1399 struct _vki_fpstate {
1400    unsigned long cw ;   1400    unsigned long cw ;
1401    unsigned long sw ;   1401    unsigned long sw ;
1402    unsigned long tag ;   1402    unsigned long tag ;
1403    unsigned long ipoff ;   1403    unsigned long ipoff ;
1404    unsigned long cssel ;   1404    unsigned long cssel ;
1405    unsigned long dataoff ;   1405    unsigned long dataoff ;
1406    unsigned long datasel ;   1406    unsigned long datasel ;
1407    struct _vki_fpreg _st[8] ;   1407    struct _vki_fpreg _st[8] ;
1408    unsigned short status ;   1408    unsigned short status ;
1409    unsigned short magic ;   1409    unsigned short magic ;
1410    unsigned long _fxsr_env[6] ;   1410    unsigned long _fxsr_env[6] ;
1411    unsigned long mxcsr ;   1411    unsigned long mxcsr ;
1412    unsigned long reserved ;   1412    unsigned long reserved ;
1413    struct _vki_fpxreg _fxsr_st[8] ;   1413    struct _vki_fpxreg _fxsr_st[8] ;
1414    struct _vki_xmmreg _xmm[8] ;   1414    struct _vki_xmmreg _xmm[8] ;
1415    unsigned long padding[56] ;   1415    unsigned long padding[56] ;
1416 };   1416 };
1417 struct vki_sigcontext {   1417 struct vki_sigcontext {
1418    unsigned short gs ;   1418    unsigned short gs ;
1419    unsigned short __gsh ;   1419    unsigned short __gsh ;
1420    unsigned short fs ;   1420    unsigned short fs ;
1421    unsigned short __fsh ;   1421    unsigned short __fsh ;
1422    unsigned short es ;   1422    unsigned short es ;
1423    unsigned short __esh ;   1423    unsigned short __esh ;
1424    unsigned short ds ;   1424    unsigned short ds ;
1425    unsigned short __dsh ;   1425    unsigned short __dsh ;
1426    unsigned long edi ;   1426    unsigned long edi ;
1427    unsigned long esi ;   1427    unsigned long esi ;
1428    unsigned long ebp ;   1428    unsigned long ebp ;
1429    unsigned long esp ;   1429    unsigned long esp ;
1430    unsigned long ebx ;   1430    unsigned long ebx ;
1431    unsigned long edx ;   1431    unsigned long edx ;
1432    unsigned long ecx ;   1432    unsigned long ecx ;
1433    unsigned long eax ;   1433    unsigned long eax ;
1434    unsigned long trapno ;   1434    unsigned long trapno ;
1435    unsigned long err ;   1435    unsigned long err ;
1436    unsigned long eip ;   1436    unsigned long eip ;
1437    unsigned short cs ;   1437    unsigned short cs ;
1438    unsigned short __csh ;   1438    unsigned short __csh ;
1439    unsigned long eflags ;   1439    unsigned long eflags ;
1440    unsigned long esp_at_signal ;   1440    unsigned long esp_at_signal ;
1441    unsigned short ss ;   1441    unsigned short ss ;
1442    unsigned short __ssh ;   1442    unsigned short __ssh ;
1443    struct _vki_fpstate *fpstate ;   1443    struct _vki_fpstate *fpstate ;
1444    unsigned long oldmask ;   1444    unsigned long oldmask ;
1445    unsigned long cr2 ;   1445    unsigned long cr2 ;
1446 };   1446 };
1447 struct vki_stat {   1447 struct vki_stat {
1448    unsigned long st_dev ;   1448    unsigned long st_dev ;
1449    unsigned long st_ino ;   1449    unsigned long st_ino ;
1450    unsigned short st_mode ;   1450    unsigned short st_mode ;
1451    unsigned short st_nlink ;   1451    unsigned short st_nlink ;
1452    unsigned short st_uid ;   1452    unsigned short st_uid ;
1453    unsigned short st_gid ;   1453    unsigned short st_gid ;
1454    unsigned long st_rdev ;   1454    unsigned long st_rdev ;
1455    unsigned long st_size ;   1455    unsigned long st_size ;
1456    unsigned long st_blksize ;   1456    unsigned long st_blksize ;
1457    unsigned long st_blocks ;   1457    unsigned long st_blocks ;
1458    unsigned long st_atime ;   1458    unsigned long st_atime ;
1459    unsigned long st_atime_nsec ;   1459    unsigned long st_atime_nsec ;
1460    unsigned long st_mtime ;   1460    unsigned long st_mtime ;
1461    unsigned long st_mtime_nsec ;   1461    unsigned long st_mtime_nsec ;
1462    unsigned long st_ctime ;   1462    unsigned long st_ctime ;
1463    unsigned long st_ctime_nsec ;   1463    unsigned long st_ctime_nsec ;
1464    unsigned long __unused4 ;   1464    unsigned long __unused4 ;
1465    unsigned long __unused5 ;   1465    unsigned long __unused5 ;
1466 };   1466 };
1467 struct vki_stat64 {   1467 struct vki_stat64 {
1468    unsigned long long st_dev ;   1468    unsigned long long st_dev ;
1469    unsigned char __pad0[4] ;   1469    unsigned char __pad0[4] ;
1470    unsigned long __st_ino ;   1470    unsigned long __st_ino ;
1471    unsigned int st_mode ;   1471    unsigned int st_mode ;
1472    unsigned int st_nlink ;   1472    unsigned int st_nlink ;
1473    unsigned long st_uid ;   1473    unsigned long st_uid ;
1474    unsigned long st_gid ;   1474    unsigned long st_gid ;
1475    unsigned long long st_rdev ;   1475    unsigned long long st_rdev ;
1476    unsigned char __pad3[4] ;   1476    unsigned char __pad3[4] ;
1477    long long st_size ;   1477    long long st_size ;
1478    unsigned long st_blksize ;   1478    unsigned long st_blksize ;
1479    unsigned long st_blocks ;   1479    unsigned long st_blocks ;
1480    unsigned long __pad4 ;   1480    unsigned long __pad4 ;
1481    unsigned long st_atime ;   1481    unsigned long st_atime ;
1482    unsigned long st_atime_nsec ;   1482    unsigned long st_atime_nsec ;
1483    unsigned long st_mtime ;   1483    unsigned long st_mtime ;
1484    unsigned int st_mtime_nsec ;   1484    unsigned int st_mtime_nsec ;
1485    unsigned long st_ctime ;   1485    unsigned long st_ctime ;
1486    unsigned long st_ctime_nsec ;   1486    unsigned long st_ctime_nsec ;
1487    unsigned long long st_ino ;   1487    unsigned long long st_ino ;
1488 };   1488 };
1489 struct vki_statfs {   1489 struct vki_statfs {
1490    __vki_u32 f_type ;   1490    __vki_u32 f_type ;
1491    __vki_u32 f_bsize ;   1491    __vki_u32 f_bsize ;
1492    __vki_u32 f_blocks ;   1492    __vki_u32 f_blocks ;
1493    __vki_u32 f_bfree ;   1493    __vki_u32 f_bfree ;
1494    __vki_u32 f_bavail ;   1494    __vki_u32 f_bavail ;
1495    __vki_u32 f_files ;   1495    __vki_u32 f_files ;
1496    __vki_u32 f_ffree ;   1496    __vki_u32 f_ffree ;
1497    __vki_kernel_fsid_t f_fsid ;   1497    __vki_kernel_fsid_t f_fsid ;
1498    __vki_u32 f_namelen ;   1498    __vki_u32 f_namelen ;
1499    __vki_u32 f_frsize ;   1499    __vki_u32 f_frsize ;
1500    __vki_u32 f_spare[5] ;   1500    __vki_u32 f_spare[5] ;
1501 };   1501 };
1502 struct vki_winsize {   1502 struct vki_winsize {
1503    unsigned short ws_row ;   1503    unsigned short ws_row ;
1504    unsigned short ws_col ;   1504    unsigned short ws_col ;
1505    unsigned short ws_xpixel ;   1505    unsigned short ws_xpixel ;
1506    unsigned short ws_ypixel ;   1506    unsigned short ws_ypixel ;
1507 };   1507 };
1508 struct vki_termio {   1508 struct vki_termio {
1509    unsigned short c_iflag ;   1509    unsigned short c_iflag ;
1510    unsigned short c_oflag ;   1510    unsigned short c_oflag ;
1511    unsigned short c_cflag ;   1511    unsigned short c_cflag ;
1512    unsigned short c_lflag ;   1512    unsigned short c_lflag ;
1513    unsigned char c_line ;   1513    unsigned char c_line ;
1514    unsigned char c_cc[8] ;   1514    unsigned char c_cc[8] ;
1515 };   1515 };
1516 typedef unsigned char vki_cc_t;   1516 typedef unsigned char vki_cc_t;
1517 typedef unsigned int vki_tcflag_t;   1517 typedef unsigned int vki_tcflag_t;
1518 struct vki_termios {   1518 struct vki_termios {
1519    vki_tcflag_t c_iflag ;   1519    vki_tcflag_t c_iflag ;
1520    vki_tcflag_t c_oflag ;   1520    vki_tcflag_t c_oflag ;
1521    vki_tcflag_t c_cflag ;   1521    vki_tcflag_t c_cflag ;
1522    vki_tcflag_t c_lflag ;   1522    vki_tcflag_t c_lflag ;
1523    vki_cc_t c_line ;   1523    vki_cc_t c_line ;
1524    vki_cc_t c_cc[19] ;   1524    vki_cc_t c_cc[19] ;
1525 };   1525 };
1526 struct vki_pollfd {   1526 struct vki_pollfd {
1527    int fd ;   1527    int fd ;
1528    short events ;   1528    short events ;
1529    short revents ;   1529    short revents ;
1530 };   1530 };
1531 struct vki_user_i387_struct {   1531 struct vki_user_i387_struct {
1532    long cwd ;   1532    long cwd ;
1533    long swd ;   1533    long swd ;
1534    long twd ;   1534    long twd ;
1535    long fip ;   1535    long fip ;
1536    long fcs ;   1536    long fcs ;
1537    long foo ;   1537    long foo ;
1538    long fos ;   1538    long fos ;
1539    long st_space[20] ;   1539    long st_space[20] ;
1540 };   1540 };
1541 struct vki_user_fxsr_struct {   1541 struct vki_user_fxsr_struct {
1542    unsigned short cwd ;   1542    unsigned short cwd ;
1543    unsigned short swd ;   1543    unsigned short swd ;
1544    unsigned short twd ;   1544    unsigned short twd ;
1545    unsigned short fop ;   1545    unsigned short fop ;
1546    long fip ;   1546    long fip ;
1547    long fcs ;   1547    long fcs ;
1548    long foo ;   1548    long foo ;
1549    long fos ;   1549    long fos ;
1550    long mxcsr ;   1550    long mxcsr ;
1551    long reserved ;   1551    long reserved ;
1552    long st_space[32] ;   1552    long st_space[32] ;
1553    long xmm_space[32] ;   1553    long xmm_space[32] ;
1554    long padding[56] ;   1554    long padding[56] ;
1555 };   1555 };
1556 struct vki_user_regs_struct {   1556 struct vki_user_regs_struct {
1557    long ebx ;   1557    long ebx ;
1558    long ecx ;   1558    long ecx ;
1559    long edx ;   1559    long edx ;
1560    long esi ;   1560    long esi ;
1561    long edi ;   1561    long edi ;
1562    long ebp ;   1562    long ebp ;
1563    long eax ;   1563    long eax ;
1564    unsigned short ds ;   1564    unsigned short ds ;
1565    unsigned short __ds ;   1565    unsigned short __ds ;
1566    unsigned short es ;   1566    unsigned short es ;
1567    unsigned short __es ;   1567    unsigned short __es ;
1568    unsigned short fs ;   1568    unsigned short fs ;
1569    unsigned short __fs ;   1569    unsigned short __fs ;
1570    unsigned short gs ;   1570    unsigned short gs ;
1571    unsigned short __gs ;   1571    unsigned short __gs ;
1572    long orig_eax ;   1572    long orig_eax ;
1573    long eip ;   1573    long eip ;
1574    unsigned short cs ;   1574    unsigned short cs ;
1575    unsigned short __cs ;   1575    unsigned short __cs ;
1576    long eflags ;   1576    long eflags ;
1577    long esp ;   1577    long esp ;
1578    unsigned short ss ;   1578    unsigned short ss ;
1579    unsigned short __ss ;   1579    unsigned short __ss ;
1580 };   1580 };
1581 typedef unsigned long vki_elf_greg_t;   1581 typedef unsigned long vki_elf_greg_t;
1582 typedef vki_elf_greg_t vki_elf_gregset_t[sizeof(struct vki_user_regs_struct ) / sizeof(vki_elf_greg_t )];   1582 typedef vki_elf_greg_t vki_elf_gregset_t[sizeof(struct vki_user_regs_struct ) / sizeof(vki_elf_greg_t )];
1583 typedef struct vki_user_i387_struct vki_elf_fpregset_t;   1583 typedef struct vki_user_i387_struct vki_elf_fpregset_t;
1584 typedef struct vki_user_fxsr_struct vki_elf_fpxregset_t;   1584 typedef struct vki_user_fxsr_struct vki_elf_fpxregset_t;
1585 struct vki_ucontext {   1585 struct vki_ucontext {
1586    unsigned long uc_flags ;   1586    unsigned long uc_flags ;
1587    struct vki_ucontext *uc_link ;   1587    struct vki_ucontext *uc_link ;
1588    vki_stack_t uc_stack ;   1588    vki_stack_t uc_stack ;
1589    struct vki_sigcontext uc_mcontext ;   1589    struct vki_sigcontext uc_mcontext ;
1590    vki_sigset_t uc_sigmask ;   1590    vki_sigset_t uc_sigmask ;
1591 };   1591 };
1592 struct vki_user_desc {   1592 struct vki_user_desc {
1593    unsigned int entry_number ;   1593    unsigned int entry_number ;
1594    unsigned long base_addr ;   1594    unsigned long base_addr ;
1595    unsigned int limit ;   1595    unsigned int limit ;
1596    unsigned int seg_32bit : 1 ;   1596    unsigned int seg_32bit : 1 ;
1597    unsigned int contents : 2 ;   1597    unsigned int contents : 2 ;
1598    unsigned int read_exec_only : 1 ;   1598    unsigned int read_exec_only : 1 ;
1599    unsigned int limit_in_pages : 1 ;   1599    unsigned int limit_in_pages : 1 ;
1600    unsigned int seg_not_present : 1 ;   1600    unsigned int seg_not_present : 1 ;
1601    unsigned int useable : 1 ;   1601    unsigned int useable : 1 ;
1602    unsigned int reserved : 25 ;   1602    unsigned int reserved : 25 ;
1603 };   1603 };
1604 typedef struct vki_user_desc vki_modify_ldt_t;   1604 typedef struct vki_user_desc vki_modify_ldt_t;
1605 struct vki_ipc64_perm {   1605 struct vki_ipc64_perm {
1606    __vki_kernel_key_t key ;   1606    __vki_kernel_key_t key ;
1607    __vki_kernel_uid32_t uid ;   1607    __vki_kernel_uid32_t uid ;
1608    __vki_kernel_gid32_t gid ;   1608    __vki_kernel_gid32_t gid ;
1609    __vki_kernel_uid32_t cuid ;   1609    __vki_kernel_uid32_t cuid ;
1610    __vki_kernel_gid32_t cgid ;   1610    __vki_kernel_gid32_t cgid ;
1611    __vki_kernel_mode_t mode ;   1611    __vki_kernel_mode_t mode ;
1612    unsigned short __pad1 ;   1612    unsigned short __pad1 ;
1613    unsigned short seq ;   1613    unsigned short seq ;
1614    unsigned short __pad2 ;   1614    unsigned short __pad2 ;
1615    unsigned long __unused1 ;   1615    unsigned long __unused1 ;
1616    unsigned long __unused2 ;   1616    unsigned long __unused2 ;
1617 };   1617 };
1618 struct vki_semid64_ds {   1618 struct vki_semid64_ds {
1619    struct vki_ipc64_perm sem_perm ;   1619    struct vki_ipc64_perm sem_perm ;
1620    __vki_kernel_time_t sem_otime ;   1620    __vki_kernel_time_t sem_otime ;
1621    unsigned long __unused1 ;   1621    unsigned long __unused1 ;
1622    __vki_kernel_time_t sem_ctime ;   1622    __vki_kernel_time_t sem_ctime ;
1623    unsigned long __unused2 ;   1623    unsigned long __unused2 ;
1624    unsigned long sem_nsems ;   1624    unsigned long sem_nsems ;
1625    unsigned long __unused3 ;   1625    unsigned long __unused3 ;
1626    unsigned long __unused4 ;   1626    unsigned long __unused4 ;
1627 };   1627 };
1628 struct vki_msqid64_ds {   1628 struct vki_msqid64_ds {
1629    struct vki_ipc64_perm msg_perm ;   1629    struct vki_ipc64_perm msg_perm ;
1630    __vki_kernel_time_t msg_stime ;   1630    __vki_kernel_time_t msg_stime ;
1631    unsigned long __unused1 ;   1631    unsigned long __unused1 ;
1632    __vki_kernel_time_t msg_rtime ;   1632    __vki_kernel_time_t msg_rtime ;
1633    unsigned long __unused2 ;   1633    unsigned long __unused2 ;
1634    __vki_kernel_time_t msg_ctime ;   1634    __vki_kernel_time_t msg_ctime ;
1635    unsigned long __unused3 ;   1635    unsigned long __unused3 ;
1636    unsigned long msg_cbytes ;   1636    unsigned long msg_cbytes ;
1637    unsigned long msg_qnum ;   1637    unsigned long msg_qnum ;
1638    unsigned long msg_qbytes ;   1638    unsigned long msg_qbytes ;
1639    __vki_kernel_pid_t msg_lspid ;   1639    __vki_kernel_pid_t msg_lspid ;
1640    __vki_kernel_pid_t msg_lrpid ;   1640    __vki_kernel_pid_t msg_lrpid ;
1641    unsigned long __unused4 ;   1641    unsigned long __unused4 ;
1642    unsigned long __unused5 ;   1642    unsigned long __unused5 ;
1643 };   1643 };
1644 struct vki_msgbuf;   1644 struct vki_msgbuf;
1645 struct vki_ipc_kludge {   1645 struct vki_ipc_kludge {
1646    struct vki_msgbuf *msgp ;   1646    struct vki_msgbuf *msgp ;
1647    long msgtyp ;   1647    long msgtyp ;
1648 };   1648 };
1649 struct vki_shmid64_ds {   1649 struct vki_shmid64_ds {
1650    struct vki_ipc64_perm shm_perm ;   1650    struct vki_ipc64_perm shm_perm ;
1651    vki_size_t shm_segsz ;   1651    vki_size_t shm_segsz ;
1652    __vki_kernel_time_t shm_atime ;   1652    __vki_kernel_time_t shm_atime ;
1653    unsigned long __unused1 ;   1653    unsigned long __unused1 ;
1654    __vki_kernel_time_t shm_dtime ;   1654    __vki_kernel_time_t shm_dtime ;
1655    unsigned long __unused2 ;   1655    unsigned long __unused2 ;
1656    __vki_kernel_time_t shm_ctime ;   1656    __vki_kernel_time_t shm_ctime ;
1657    unsigned long __unused3 ;   1657    unsigned long __unused3 ;
1658    __vki_kernel_pid_t shm_cpid ;   1658    __vki_kernel_pid_t shm_cpid ;
1659    __vki_kernel_pid_t shm_lpid ;   1659    __vki_kernel_pid_t shm_lpid ;
1660    unsigned long shm_nattch ;   1660    unsigned long shm_nattch ;
1661    unsigned long __unused4 ;   1661    unsigned long __unused4 ;
1662    unsigned long __unused5 ;   1662    unsigned long __unused5 ;
1663 };   1663 };
1664 struct vki_shminfo64 {   1664 struct vki_shminfo64 {
1665    unsigned long shmmax ;   1665    unsigned long shmmax ;
1666    unsigned long shmmin ;   1666    unsigned long shmmin ;
1667    unsigned long shmmni ;   1667    unsigned long shmmni ;
1668    unsigned long shmseg ;   1668    unsigned long shmseg ;
1669    unsigned long shmall ;   1669    unsigned long shmall ;
1670    unsigned long __unused1 ;   1670    unsigned long __unused1 ;
1671    unsigned long __unused2 ;   1671    unsigned long __unused2 ;
1672    unsigned long __unused3 ;   1672    unsigned long __unused3 ;
1673    unsigned long __unused4 ;   1673    unsigned long __unused4 ;
1674 };   1674 };
1675 struct vki_vm86_regs {   1675 struct vki_vm86_regs {
1676    long ebx ;   1676    long ebx ;
1677    long ecx ;   1677    long ecx ;
1678    long edx ;   1678    long edx ;
1679    long esi ;   1679    long esi ;
1680    long edi ;   1680    long edi ;
1681    long ebp ;   1681    long ebp ;
1682    long eax ;   1682    long eax ;
1683    long __null_ds ;   1683    long __null_ds ;
1684    long __null_es ;   1684    long __null_es ;
1685    long __null_fs ;   1685    long __null_fs ;
1686    long __null_gs ;   1686    long __null_gs ;
1687    long orig_eax ;   1687    long orig_eax ;
1688    long eip ;   1688    long eip ;
1689    unsigned short cs ;   1689    unsigned short cs ;
1690    unsigned short __csh ;   1690    unsigned short __csh ;
1691    long eflags ;   1691    long eflags ;
1692    long esp ;   1692    long esp ;
1693    unsigned short ss ;   1693    unsigned short ss ;
1694    unsigned short __ssh ;   1694    unsigned short __ssh ;
1695    unsigned short es ;   1695    unsigned short es ;
1696    unsigned short __esh ;   1696    unsigned short __esh ;
1697    unsigned short ds ;   1697    unsigned short ds ;
1698    unsigned short __dsh ;   1698    unsigned short __dsh ;
1699    unsigned short fs ;   1699    unsigned short fs ;
1700    unsigned short __fsh ;   1700    unsigned short __fsh ;
1701    unsigned short gs ;   1701    unsigned short gs ;
1702    unsigned short __gsh ;   1702    unsigned short __gsh ;
1703 };   1703 };
1704 struct vki_revectored_struct {   1704 struct vki_revectored_struct {
1705    unsigned long __map[8] ;   1705    unsigned long __map[8] ;
1706 };   1706 };
1707 struct vki_vm86_struct {   1707 struct vki_vm86_struct {
1708    struct vki_vm86_regs regs ;   1708    struct vki_vm86_regs regs ;
1709    unsigned long flags ;   1709    unsigned long flags ;
1710    unsigned long screen_bitmap ;   1710    unsigned long screen_bitmap ;
1711    unsigned long cpu_type ;   1711    unsigned long cpu_type ;
1712    struct vki_revectored_struct int_revectored ;   1712    struct vki_revectored_struct int_revectored ;
1713    struct vki_revectored_struct int21_revectored ;   1713    struct vki_revectored_struct int21_revectored ;
1714 };   1714 };
1715 struct vki_vm86plus_info_struct {   1715 struct vki_vm86plus_info_struct {
1716    unsigned long force_return_for_pic : 1 ;   1716    unsigned long force_return_for_pic : 1 ;
1717    unsigned long vm86dbg_active : 1 ;   1717    unsigned long vm86dbg_active : 1 ;
1718    unsigned long vm86dbg_TFpendig : 1 ;   1718    unsigned long vm86dbg_TFpendig : 1 ;
1719    unsigned long unused : 28 ;   1719    unsigned long unused : 28 ;
1720    unsigned long is_vm86pus : 1 ;   1720    unsigned long is_vm86pus : 1 ;
1721    unsigned char vm86dbg_intxxtab[32] ;   1721    unsigned char vm86dbg_intxxtab[32] ;
1722 };   1722 };
1723 struct vki_vm86plus_struct {   1723 struct vki_vm86plus_struct {
1724    struct vki_vm86_regs regs ;   1724    struct vki_vm86_regs regs ;
1725    unsigned long flags ;   1725    unsigned long flags ;
1726    unsigned long screen_bitmap ;   1726    unsigned long screen_bitmap ;
1727    unsigned long cpu_type ;   1727    unsigned long cpu_type ;
1728    struct vki_revectored_struct int_revectored ;   1728    struct vki_revectored_struct int_revectored ;
1729    struct vki_revectored_struct int21_revectored ;   1729    struct vki_revectored_struct int21_revectored ;
1730    struct vki_vm86plus_info_struct vm86plus ;   1730    struct vki_vm86plus_info_struct vm86plus ;
1731 };   1731 };
1732 typedef __vki_s32 vki_int32_t;   1732 typedef __vki_s32 vki_int32_t;
1733 typedef __vki_u8 vki_uint8_t;   1733 typedef __vki_u8 vki_uint8_t;
1734 typedef __vki_u16 vki_uint16_t;   1734 typedef __vki_u16 vki_uint16_t;
1735 typedef __vki_u32 vki_uint32_t;   1735 typedef __vki_u32 vki_uint32_t;
1736 struct vki_sysinfo {   1736 struct vki_sysinfo {
1737    long uptime ;   1737    long uptime ;
1738    unsigned long loads[3] ;   1738    unsigned long loads[3] ;
1739    unsigned long totalram ;   1739    unsigned long totalram ;
1740    unsigned long freeram ;   1740    unsigned long freeram ;
1741    unsigned long sharedram ;   1741    unsigned long sharedram ;
1742    unsigned long bufferram ;   1742    unsigned long bufferram ;
1743    unsigned long totalswap ;   1743    unsigned long totalswap ;
1744    unsigned long freeswap ;   1744    unsigned long freeswap ;
1745    unsigned short procs ;   1745    unsigned short procs ;
1746    unsigned short pad ;   1746    unsigned short pad ;
1747    unsigned long totalhigh ;   1747    unsigned long totalhigh ;
1748    unsigned long freehigh ;   1748    unsigned long freehigh ;
1749    unsigned int mem_unit ;   1749    unsigned int mem_unit ;
1750    char _f[(20U - 2U * sizeof(long )) - sizeof(int )] ;   1750    char _f[(20U - 2U * sizeof(long )) - sizeof(int )] ;
1751 };   1751 };
1752 struct vki_timespec {   1752 struct vki_timespec {
1753    vki_time_t tv_sec ;   1753    vki_time_t tv_sec ;
1754    long tv_nsec ;   1754    long tv_nsec ;
1755 };   1755 };
1756 struct vki_timeval {   1756 struct vki_timeval {
1757    vki_time_t tv_sec ;   1757    vki_time_t tv_sec ;
1758    vki_suseconds_t tv_usec ;   1758    vki_suseconds_t tv_usec ;
1759 };   1759 };
1760 struct vki_timezone {   1760 struct vki_timezone {
1761    int tz_minuteswest ;   1761    int tz_minuteswest ;
1762    int tz_dsttime ;   1762    int tz_dsttime ;
1763 };   1763 };
1764 struct vki_itimerspec {   1764 struct vki_itimerspec {
1765    struct vki_timespec it_interval ;   1765    struct vki_timespec it_interval ;
1766    struct vki_timespec it_value ;   1766    struct vki_timespec it_value ;
1767 };   1767 };
1768 struct vki_itimerval {   1768 struct vki_itimerval {
1769    struct vki_timeval it_interval ;   1769    struct vki_timeval it_interval ;
1770    struct vki_timeval it_value ;   1770    struct vki_timeval it_value ;
1771 };   1771 };
1772 struct vki_timex {   1772 struct vki_timex {
1773    unsigned int modes ;   1773    unsigned int modes ;
1774    long offset ;   1774    long offset ;
1775    long freq ;   1775    long freq ;
1776    long maxerror ;   1776    long maxerror ;
1777    long esterror ;   1777    long esterror ;
1778    int status ;   1778    int status ;
1779    long constant ;   1779    long constant ;
1780    long precision ;   1780    long precision ;
1781    long tolerance ;   1781    long tolerance ;
1782    struct vki_timeval time ;   1782    struct vki_timeval time ;
1783    long tick ;   1783    long tick ;
1784    long ppsfreq ;   1784    long ppsfreq ;
1785    long jitter ;   1785    long jitter ;
1786    int shift ;   1786    int shift ;
1787    long stabil ;   1787    long stabil ;
1788    long jitcnt ;   1788    long jitcnt ;
1789    long calcnt ;   1789    long calcnt ;
1790    long errcnt ;   1790    long errcnt ;
1791    long stbcnt ;   1791    long stbcnt ;
1792    int  : 32 ;   1792    int  : 32 ;
1793    int  : 32 ;   1793    int  : 32 ;
1794    int  : 32 ;   1794    int  : 32 ;
1795    int  : 32 ;   1795    int  : 32 ;
1796    int  : 32 ;   1796    int  : 32 ;
1797    int  : 32 ;   1797    int  : 32 ;
1798    int  : 32 ;   1798    int  : 32 ;
1799    int  : 32 ;   1799    int  : 32 ;
1800    int  : 32 ;   1800    int  : 32 ;
1801    int  : 32 ;   1801    int  : 32 ;
1802    int  : 32 ;   1802    int  : 32 ;
1803    int  : 32 ;   1803    int  : 32 ;
1804 };   1804 };
1805 struct vki_tms {   1805 struct vki_tms {
1806    vki_clock_t tms_utime ;   1806    vki_clock_t tms_utime ;
1807    vki_clock_t tms_stime ;   1807    vki_clock_t tms_stime ;
1808    vki_clock_t tms_cutime ;   1808    vki_clock_t tms_cutime ;
1809    vki_clock_t tms_cstime ;   1809    vki_clock_t tms_cstime ;
1810 };   1810 };
1811 struct vki_utimbuf {   1811 struct vki_utimbuf {
1812    vki_time_t actime ;   1812    vki_time_t actime ;
1813    vki_time_t modtime ;   1813    vki_time_t modtime ;
1814 };   1814 };
1815 struct vki_sched_param {   1815 struct vki_sched_param {
1816    int sched_priority ;   1816    int sched_priority ;
1817 };   1817 };
1818 union vki_sigval {   1818 union vki_sigval {
1819    int sival_int ;   1819    int sival_int ;
1820    void *sival_ptr ;   1820    void *sival_ptr ;
1821 };   1821 };
1822 typedef union vki_sigval vki_sigval_t;   1822 typedef union vki_sigval vki_sigval_t;
1823 struct __anonstruct__kill_70 {   1823 struct __anonstruct__kill_70 {
1824    vki_pid_t _pid ;   1824    vki_pid_t _pid ;
1825    vki_uid_t _uid ;   1825    vki_uid_t _uid ;
1826 };   1826 };
1827 struct __anonstruct__timer_71 {   1827 struct __anonstruct__timer_71 {
1828    vki_timer_t _tid ;   1828    vki_timer_t _tid ;
1829    int _overrun ;   1829    int _overrun ;
1830    char _pad[sizeof(vki_uid_t ) - sizeof(int )] ;   1830    char _pad[sizeof(vki_uid_t ) - sizeof(int )] ;
1831    vki_sigval_t _sigval ;   1831    vki_sigval_t _sigval ;
1832    int _sys_private ;   1832    int _sys_private ;
1833 };   1833 };
1834 struct __anonstruct__rt_72 {   1834 struct __anonstruct__rt_72 {
1835    vki_pid_t _pid ;   1835    vki_pid_t _pid ;
1836    vki_uid_t _uid ;   1836    vki_uid_t _uid ;
1837    vki_sigval_t _sigval ;   1837    vki_sigval_t _sigval ;
1838 };   1838 };
1839 struct __anonstruct__sigchld_73 {   1839 struct __anonstruct__sigchld_73 {
1840    vki_pid_t _pid ;   1840    vki_pid_t _pid ;
1841    vki_uid_t _uid ;   1841    vki_uid_t _uid ;
1842    int _status ;   1842    int _status ;
1843    vki_clock_t _utime ;   1843    vki_clock_t _utime ;
1844    vki_clock_t _stime ;   1844    vki_clock_t _stime ;
1845 };   1845 };
1846 struct __anonstruct__sigfault_74 {   1846 struct __anonstruct__sigfault_74 {
1847    void *_addr ;   1847    void *_addr ;
1848 };   1848 };
1849 struct __anonstruct__sigpoll_75 {   1849 struct __anonstruct__sigpoll_75 {
1850    long _band ;   1850    long _band ;
1851    int _fd ;   1851    int _fd ;
1852 };   1852 };
1853 union __anonunion__sifields_69 {   1853 union __anonunion__sifields_69 {
1854    int _pad[(128U - 3U * sizeof(int )) / sizeof(int )] ;   1854    int _pad[(128U - 3U * sizeof(int )) / sizeof(int )] ;
1855    struct __anonstruct__kill_70 _kill ;   1855    struct __anonstruct__kill_70 _kill ;
1856    struct __anonstruct__timer_71 _timer ;   1856    struct __anonstruct__timer_71 _timer ;
1857    struct __anonstruct__rt_72 _rt ;   1857    struct __anonstruct__rt_72 _rt ;
1858    struct __anonstruct__sigchld_73 _sigchld ;   1858    struct __anonstruct__sigchld_73 _sigchld ;
1859    struct __anonstruct__sigfault_74 _sigfault ;   1859    struct __anonstruct__sigfault_74 _sigfault ;
1860    struct __anonstruct__sigpoll_75 _sigpoll ;   1860    struct __anonstruct__sigpoll_75 _sigpoll ;
1861 };   1861 };
1862 struct vki_siginfo {   1862 struct vki_siginfo {
1863    int si_signo ;   1863    int si_signo ;
1864    int si_errno ;   1864    int si_errno ;
1865    int si_code ;   1865    int si_code ;
1866    union __anonunion__sifields_69 _sifields ;   1866    union __anonunion__sifields_69 _sifields ;
1867 };   1867 };
1868 typedef struct vki_siginfo vki_siginfo_t;   1868 typedef struct vki_siginfo vki_siginfo_t;
1869 struct __anonstruct__sigev_thread_77 {   1869 struct __anonstruct__sigev_thread_77 {
1870    void (*_function)(vki_sigval_t  ) ;   1870    void (*_function)(vki_sigval_t  ) ;
1871    void *_attribute ;   1871    void *_attribute ;
1872 };   1872 };
1873 union __anonunion__sigev_un_76 {   1873 union __anonunion__sigev_un_76 {
1874    int _pad[(64U - (sizeof(int ) * 2U + sizeof(vki_sigval_t ))) / sizeof(int )] ;   1874    int _pad[(64U - (sizeof(int ) * 2U + sizeof(vki_sigval_t ))) / sizeof(int )] ;
1875    int _tid ;   1875    int _tid ;
1876    struct __anonstruct__sigev_thread_77 _sigev_thread ;   1876    struct __anonstruct__sigev_thread_77 _sigev_thread ;
1877 };   1877 };
1878 struct vki_sigevent {   1878 struct vki_sigevent {
1879    vki_sigval_t sigev_value ;   1879    vki_sigval_t sigev_value ;
1880    int sigev_signo ;   1880    int sigev_signo ;
1881    int sigev_notify ;   1881    int sigev_notify ;
1882    union __anonunion__sigev_un_76 _sigev_un ;   1882    union __anonunion__sigev_un_76 _sigev_un ;
1883 };   1883 };
1884 typedef struct vki_sigevent vki_sigevent_t;   1884 typedef struct vki_sigevent vki_sigevent_t;
1885 enum vki_sock_type {   1885 enum vki_sock_type {
1886     VKI_SOCK_STREAM = 1   1886     VKI_SOCK_STREAM = 1
1887 } ;   1887 } ;
1888 struct vki_iovec {   1888 struct vki_iovec {
1889    void *iov_base ;   1889    void *iov_base ;
1890    __vki_kernel_size_t iov_len ;   1890    __vki_kernel_size_t iov_len ;
1891 };   1891 };
1892 typedef unsigned short vki_sa_family_t;   1892 typedef unsigned short vki_sa_family_t;
1893 struct vki_sockaddr {   1893 struct vki_sockaddr {
1894    vki_sa_family_t sa_family ;   1894    vki_sa_family_t sa_family ;
1895    char sa_data[14] ;   1895    char sa_data[14] ;
1896 };   1896 };
1897 struct vki_msghdr {   1897 struct vki_msghdr {
1898    void *msg_name ;   1898    void *msg_name ;
1899    int msg_namelen ;   1899    int msg_namelen ;
1900    struct vki_iovec *msg_iov ;   1900    struct vki_iovec *msg_iov ;
1901    __vki_kernel_size_t msg_iovlen ;   1901    __vki_kernel_size_t msg_iovlen ;
1902    void *msg_control ;   1902    void *msg_control ;
1903    __vki_kernel_size_t msg_controllen ;   1903    __vki_kernel_size_t msg_controllen ;
1904    unsigned int msg_flags ;   1904    unsigned int msg_flags ;
1905 };   1905 };
1906 struct vki_cmsghdr {   1906 struct vki_cmsghdr {
1907    __vki_kernel_size_t cmsg_len ;   1907    __vki_kernel_size_t cmsg_len ;
1908    int cmsg_level ;   1908    int cmsg_level ;
1909    int cmsg_type ;   1909    int cmsg_type ;
1910 };   1910 };
1911 struct vki_in_addr {   1911 struct vki_in_addr {
1912    __vki_u32 s_addr ;   1912    __vki_u32 s_addr ;
1913 };   1913 };
1914 struct vki_sockaddr_in {   1914 struct vki_sockaddr_in {
1915    vki_sa_family_t sin_family ;   1915    vki_sa_family_t sin_family ;
1916    unsigned short sin_port ;   1916    unsigned short sin_port ;
1917    struct vki_in_addr sin_addr ;   1917    struct vki_in_addr sin_addr ;
1918    unsigned char __pad[((16U - sizeof(short )) - sizeof(unsigned short )) - sizeof(struct vki_in_addr )] ;   1918    unsigned char __pad[((16U - sizeof(short )) - sizeof(unsigned short )) - sizeof(struct vki_in_addr )] ;
1919 };   1919 };
1920 union __anonunion_vki_in6_u_78 {   1920 union __anonunion_vki_in6_u_78 {
1921    __vki_u8 u6_addr8[16] ;   1921    __vki_u8 u6_addr8[16] ;
1922    __vki_u16 u6_addr16[8] ;   1922    __vki_u16 u6_addr16[8] ;
1923    __vki_u32 u6_addr32[4] ;   1923    __vki_u32 u6_addr32[4] ;
1924 };   1924 };
1925 struct vki_in6_addr {   1925 struct vki_in6_addr {
1926    union __anonunion_vki_in6_u_78 vki_in6_u ;   1926    union __anonunion_vki_in6_u_78 vki_in6_u ;
1927 };   1927 };
1928 struct vki_sockaddr_in6 {   1928 struct vki_sockaddr_in6 {
1929    unsigned short sin6_family ;   1929    unsigned short sin6_family ;
1930    __vki_u16 sin6_port ;   1930    __vki_u16 sin6_port ;
1931    __vki_u32 sin6_flowinfo ;   1931    __vki_u32 sin6_flowinfo ;
1932    struct vki_in6_addr sin6_addr ;   1932    struct vki_in6_addr sin6_addr ;
1933    __vki_u32 sin6_scope_id ;   1933    __vki_u32 sin6_scope_id ;
1934 };   1934 };
1935 struct vki_sockaddr_un {   1935 struct vki_sockaddr_un {
1936    vki_sa_family_t sun_family ;   1936    vki_sa_family_t sun_family ;
1937    char sun_path[108] ;   1937    char sun_path[108] ;
1938 };   1938 };
1939 struct vki_ifmap {   1939 struct vki_ifmap {
1940    unsigned long mem_start ;   1940    unsigned long mem_start ;
1941    unsigned long mem_end ;   1941    unsigned long mem_end ;
1942    unsigned short base_addr ;   1942    unsigned short base_addr ;
1943    unsigned char irq ;   1943    unsigned char irq ;
1944    unsigned char dma ;   1944    unsigned char dma ;
1945    unsigned char port ;   1945    unsigned char port ;
1946 };   1946 };
1947 union __anonunion_ifs_ifsu_79 {   1947 union __anonunion_ifs_ifsu_79 {
1948    void *raw_hdlc ;   1948    void *raw_hdlc ;
1949    void *cisco ;   1949    void *cisco ;
1950    void *fr ;   1950    void *fr ;
1951    void *fr_pvc ;   1951    void *fr_pvc ;
1952    void *fr_pvc_info ;   1952    void *fr_pvc_info ;
1953    void *sync ;   1953    void *sync ;
1954    void *te1 ;   1954    void *te1 ;
1955 };   1955 };
1956 struct vki_if_settings {   1956 struct vki_if_settings {
1957    unsigned int type ;   1957    unsigned int type ;
1958    unsigned int size ;   1958    unsigned int size ;
1959    union __anonunion_ifs_ifsu_79 ifs_ifsu ;   1959    union __anonunion_ifs_ifsu_79 ifs_ifsu ;
1960 };   1960 };
1961 union __anonunion_ifr_ifrn_80 {   1961 union __anonunion_ifr_ifrn_80 {
1962    char ifrn_name[16] ;   1962    char ifrn_name[16] ;
1963 };   1963 };
1964 union __anonunion_ifr_ifru_81 {   1964 union __anonunion_ifr_ifru_81 {
1965    struct vki_sockaddr ifru_addr ;   1965    struct vki_sockaddr ifru_addr ;
1966    struct vki_sockaddr ifru_dstaddr ;   1966    struct vki_sockaddr ifru_dstaddr ;
1967    struct vki_sockaddr ifru_broadaddr ;   1967    struct vki_sockaddr ifru_broadaddr ;
1968    struct vki_sockaddr ifru_netmask ;   1968    struct vki_sockaddr ifru_netmask ;
1969    struct vki_sockaddr ifru_hwaddr ;   1969    struct vki_sockaddr ifru_hwaddr ;
1970    short ifru_flags ;   1970    short ifru_flags ;
1971    int ifru_ivalue ;   1971    int ifru_ivalue ;
1972    int ifru_mtu ;   1972    int ifru_mtu ;
1973    struct vki_ifmap ifru_map ;   1973    struct vki_ifmap ifru_map ;
1974    char ifru_slave[16] ;   1974    char ifru_slave[16] ;
1975    char ifru_newname[16] ;   1975    char ifru_newname[16] ;
1976    void *ifru_data ;   1976    void *ifru_data ;
1977    struct vki_if_settings ifru_settings ;   1977    struct vki_if_settings ifru_settings ;
1978 };   1978 };
1979 struct vki_ifreq {   1979 struct vki_ifreq {
1980    union __anonunion_ifr_ifrn_80 ifr_ifrn ;   1980    union __anonunion_ifr_ifrn_80 ifr_ifrn ;
1981    union __anonunion_ifr_ifru_81 ifr_ifru ;   1981    union __anonunion_ifr_ifru_81 ifr_ifru ;
1982 };   1982 };
1983 union __anonunion_ifc_ifcu_82 {   1983 union __anonunion_ifc_ifcu_82 {
1984    char *ifcu_buf ;   1984    char *ifcu_buf ;
1985    struct vki_ifreq *ifcu_req ;   1985    struct vki_ifreq *ifcu_req ;
1986 };   1986 };
1987 struct vki_ifconf {   1987 struct vki_ifconf {
1988    int ifc_len ;   1988    int ifc_len ;
1989    union __anonunion_ifc_ifcu_82 ifc_ifcu ;   1989    union __anonunion_ifc_ifcu_82 ifc_ifcu ;
1990 };   1990 };
1991 struct vki_arpreq {   1991 struct vki_arpreq {
1992    struct vki_sockaddr arp_pa ;   1992    struct vki_sockaddr arp_pa ;
1993    struct vki_sockaddr arp_ha ;   1993    struct vki_sockaddr arp_ha ;
1994    int arp_flags ;   1994    int arp_flags ;
1995    struct vki_sockaddr arp_netmask ;   1995    struct vki_sockaddr arp_netmask ;
1996    char arp_dev[16] ;   1996    char arp_dev[16] ;
1997 };   1997 };
1998 struct vki_rtentry {   1998 struct vki_rtentry {
1999    unsigned long rt_pad1 ;   1999    unsigned long rt_pad1 ;
2000    struct vki_sockaddr rt_dst ;   2000    struct vki_sockaddr rt_dst ;
2001    struct vki_sockaddr rt_gateway ;   2001    struct vki_sockaddr rt_gateway ;
2002    struct vki_sockaddr rt_genmask ;   2002    struct vki_sockaddr rt_genmask ;
2003    unsigned short rt_flags ;   2003    unsigned short rt_flags ;
2004    short rt_pad2 ;   2004    short rt_pad2 ;
2005    unsigned long rt_pad3 ;   2005    unsigned long rt_pad3 ;
2006    void *rt_pad4 ;   2006    void *rt_pad4 ;
2007    short rt_metric ;   2007    short rt_metric ;
2008    char *rt_dev ;   2008    char *rt_dev ;
2009    unsigned long rt_mtu ;   2009    unsigned long rt_mtu ;
2010    unsigned long rt_window ;   2010    unsigned long rt_window ;
2011    unsigned short rt_irtt ;   2011    unsigned short rt_irtt ;
2012 };   2012 };
2013 typedef __vki_s32 vki_sctp_assoc_t;   2013 typedef __vki_s32 vki_sctp_assoc_t;
2014 enum vki_sctp_optname {   2014 enum vki_sctp_optname {
2015     VKI_SCTP_RTOINFO = 0,   2015     VKI_SCTP_RTOINFO = 0,
2016     VKI_SCTP_ASSOCINFO = 1,   2016     VKI_SCTP_ASSOCINFO = 1,
2017     VKI_SCTP_INITMSG = 2,   2017     VKI_SCTP_INITMSG = 2,
2018     VKI_SCTP_NODELAY = 3,   2018     VKI_SCTP_NODELAY = 3,
2019     VKI_SCTP_AUTOCLOSE = 4,   2019     VKI_SCTP_AUTOCLOSE = 4,
2020     VKI_SCTP_SET_PEER_PRIMARY_ADDR = 5,   2020     VKI_SCTP_SET_PEER_PRIMARY_ADDR = 5,
2021     VKI_SCTP_PRIMARY_ADDR = 6,   2021     VKI_SCTP_PRIMARY_ADDR = 6,
2022     VKI_SCTP_ADAPTION_LAYER = 7,   2022     VKI_SCTP_ADAPTION_LAYER = 7,
2023     VKI_SCTP_DISABLE_FRAGMENTS = 8,   2023     VKI_SCTP_DISABLE_FRAGMENTS = 8,
2024     VKI_SCTP_PEER_ADDR_PARAMS = 9,   2024     VKI_SCTP_PEER_ADDR_PARAMS = 9,
2025     VKI_SCTP_DEFAULT_SEND_PARAM = 10,   2025     VKI_SCTP_DEFAULT_SEND_PARAM = 10,
2026     VKI_SCTP_EVENTS = 11,   2026     VKI_SCTP_EVENTS = 11,
2027     VKI_SCTP_I_WANT_MAPPED_V4_ADDR = 12,   2027     VKI_SCTP_I_WANT_MAPPED_V4_ADDR = 12,
2028     VKI_SCTP_MAXSEG = 13,   2028     VKI_SCTP_MAXSEG = 13,
2029     VKI_SCTP_STATUS = 14,   2029     VKI_SCTP_STATUS = 14,
2030     VKI_SCTP_GET_PEER_ADDR_INFO = 15,   2030     VKI_SCTP_GET_PEER_ADDR_INFO = 15,
2031     VKI_SCTP_SOCKOPT_BINDX_ADD = 100,   2031     VKI_SCTP_SOCKOPT_BINDX_ADD = 100,
2032     VKI_SCTP_SOCKOPT_BINDX_REM = 101,   2032     VKI_SCTP_SOCKOPT_BINDX_REM = 101,
2033     VKI_SCTP_SOCKOPT_PEELOFF = 102,   2033     VKI_SCTP_SOCKOPT_PEELOFF = 102,
2034     VKI_SCTP_GET_PEER_ADDRS_NUM = 103,   2034     VKI_SCTP_GET_PEER_ADDRS_NUM = 103,
2035     VKI_SCTP_GET_PEER_ADDRS = 104,   2035     VKI_SCTP_GET_PEER_ADDRS = 104,
2036     VKI_SCTP_GET_LOCAL_ADDRS_NUM = 105,   2036     VKI_SCTP_GET_LOCAL_ADDRS_NUM = 105,
2037     VKI_SCTP_GET_LOCAL_ADDRS = 106,   2037     VKI_SCTP_GET_LOCAL_ADDRS = 106,
2038     VKI_SCTP_SOCKOPT_CONNECTX = 107   2038     VKI_SCTP_SOCKOPT_CONNECTX = 107
2039 } ;   2039 } ;
2040 struct vki_sctp_getaddrs {   2040 struct vki_sctp_getaddrs {
2041    vki_sctp_assoc_t assoc_id ;   2041    vki_sctp_assoc_t assoc_id ;
2042    int addr_num ;   2042    int addr_num ;
2043    struct vki_sockaddr *addrs ;   2043    struct vki_sockaddr *addrs ;
2044 };   2044 };
2045 struct vki_rusage {   2045 struct vki_rusage {
2046    struct vki_timeval ru_utime ;   2046    struct vki_timeval ru_utime ;
2047    struct vki_timeval ru_stime ;   2047    struct vki_timeval ru_stime ;
2048    long ru_maxrss ;   2048    long ru_maxrss ;
2049    long ru_ixrss ;   2049    long ru_ixrss ;
2050    long ru_idrss ;   2050    long ru_idrss ;
2051    long ru_isrss ;   2051    long ru_isrss ;
2052    long ru_minflt ;   2052    long ru_minflt ;
2053    long ru_majflt ;   2053    long ru_majflt ;
2054    long ru_nswap ;   2054    long ru_nswap ;
2055    long ru_inblock ;   2055    long ru_inblock ;
2056    long ru_oublock ;   2056    long ru_oublock ;
2057    long ru_msgsnd ;   2057    long ru_msgsnd ;
2058    long ru_msgrcv ;   2058    long ru_msgrcv ;
2059    long ru_nsignals ;   2059    long ru_nsignals ;
2060    long ru_nvcsw ;   2060    long ru_nvcsw ;
2061    long ru_nivcsw ;   2061    long ru_nivcsw ;
2062 };   2062 };
2063 struct vki_rlimit {   2063 struct vki_rlimit {
2064    unsigned long rlim_cur ;   2064    unsigned long rlim_cur ;
2065    unsigned long rlim_max ;   2065    unsigned long rlim_max ;
2066 };   2066 };
2067 struct vki_elf_siginfo {   2067 struct vki_elf_siginfo {
2068    int si_signo ;   2068    int si_signo ;
2069    int si_code ;   2069    int si_code ;
2070    int si_errno ;   2070    int si_errno ;
2071 };   2071 };
2072 struct vki_elf_prstatus {   2072 struct vki_elf_prstatus {
2073    struct vki_elf_siginfo pr_info ;   2073    struct vki_elf_siginfo pr_info ;
2074    short pr_cursig ;   2074    short pr_cursig ;
2075    unsigned long pr_sigpend ;   2075    unsigned long pr_sigpend ;
2076    unsigned long pr_sighold ;   2076    unsigned long pr_sighold ;
2077    vki_pid_t pr_pid ;   2077    vki_pid_t pr_pid ;
2078    vki_pid_t pr_ppid ;   2078    vki_pid_t pr_ppid ;
2079    vki_pid_t pr_pgrp ;   2079    vki_pid_t pr_pgrp ;
2080    vki_pid_t pr_sid ;   2080    vki_pid_t pr_sid ;
2081    struct vki_timeval pr_utime ;   2081    struct vki_timeval pr_utime ;
2082    struct vki_timeval pr_stime ;   2082    struct vki_timeval pr_stime ;
2083    struct vki_timeval pr_cutime ;   2083    struct vki_timeval pr_cutime ;
2084    struct vki_timeval pr_cstime ;   2084    struct vki_timeval pr_cstime ;
2085    vki_elf_gregset_t pr_reg ;   2085    vki_elf_gregset_t pr_reg ;
2086    int pr_fpvalid ;   2086    int pr_fpvalid ;
2087 };   2087 };
2088 struct vki_elf_prpsinfo {   2088 struct vki_elf_prpsinfo {
2089    char pr_state ;   2089    char pr_state ;
2090    char pr_sname ;   2090    char pr_sname ;
2091    char pr_zomb ;   2091    char pr_zomb ;
2092    char pr_nice ;   2092    char pr_nice ;
2093    unsigned long pr_flag ;   2093    unsigned long pr_flag ;
2094    __vki_kernel_uid_t pr_uid ;   2094    __vki_kernel_uid_t pr_uid ;
2095    __vki_kernel_gid_t pr_gid ;   2095    __vki_kernel_gid_t pr_gid ;
2096    vki_pid_t pr_pid ;   2096    vki_pid_t pr_pid ;
2097    vki_pid_t pr_ppid ;   2097    vki_pid_t pr_ppid ;
2098    vki_pid_t pr_pgrp ;   2098    vki_pid_t pr_pgrp ;
2099    vki_pid_t pr_sid ;   2099    vki_pid_t pr_sid ;
2100    char pr_fname[16] ;   2100    char pr_fname[16] ;
2101    char pr_psargs[80] ;   2101    char pr_psargs[80] ;
2102 };   2102 };
2103 struct vki_epoll_event {   2103 struct vki_epoll_event {
2104    __vki_u32 events ;   2104    __vki_u32 events ;
2105    __vki_u64 data ;   2105    __vki_u64 data ;
2106 };   2106 };
2107 struct vki_mq_attr {   2107 struct vki_mq_attr {
2108    long mq_flags ;   2108    long mq_flags ;
2109    long mq_maxmsg ;   2109    long mq_maxmsg ;
2110    long mq_msgsize ;   2110    long mq_msgsize ;
2111    long mq_curmsgs ;   2111    long mq_curmsgs ;
2112    long __reserved[4] ;   2112    long __reserved[4] ;
2113 };   2113 };
2114 struct vki_new_utsname {   2114 struct vki_new_utsname {
2115    char sysname[65] ;   2115    char sysname[65] ;
2116    char nodename[65] ;   2116    char nodename[65] ;
2117    char release[65] ;   2117    char release[65] ;
2118    char version[65] ;   2118    char version[65] ;
2119    char machine[65] ;   2119    char machine[65] ;
2120    char domainname[65] ;   2120    char domainname[65] ;
2121 };   2121 };
2122 struct vki_mii_ioctl_data {   2122 struct vki_mii_ioctl_data {
2123    vki_u16 phy_id ;   2123    vki_u16 phy_id ;
2124    vki_u16 reg_num ;   2124    vki_u16 reg_num ;
2125    vki_u16 val_in ;   2125    vki_u16 val_in ;
2126    vki_u16 val_out ;   2126    vki_u16 val_out ;
2127 };   2127 };
2128 struct __vki_user_cap_header_struct {   2128 struct __vki_user_cap_header_struct {
2129    __vki_u32 version ;   2129    __vki_u32 version ;
2130    int pid ;   2130    int pid ;
2131 };   2131 };
2132 typedef struct __vki_user_cap_header_struct *vki_cap_user_header_t;   2132 typedef struct __vki_user_cap_header_struct *vki_cap_user_header_t;
2133 struct __vki_user_cap_data_struct {   2133 struct __vki_user_cap_data_struct {
2134    __vki_u32 effective ;   2134    __vki_u32 effective ;
2135    __vki_u32 permitted ;   2135    __vki_u32 permitted ;
2136    __vki_u32 inheritable ;   2136    __vki_u32 inheritable ;
2137 };   2137 };
2138 typedef struct __vki_user_cap_data_struct *vki_cap_user_data_t;   2138 typedef struct __vki_user_cap_data_struct *vki_cap_user_data_t;
2139 struct vki_ipc_perm {   2139 struct vki_ipc_perm {
2140    __vki_kernel_key_t key ;   2140    __vki_kernel_key_t key ;
2141    __vki_kernel_uid_t uid ;   2141    __vki_kernel_uid_t uid ;
2142    __vki_kernel_gid_t gid ;   2142    __vki_kernel_gid_t gid ;
2143    __vki_kernel_uid_t cuid ;   2143    __vki_kernel_uid_t cuid ;
2144    __vki_kernel_gid_t cgid ;   2144    __vki_kernel_gid_t cgid ;
2145    __vki_kernel_mode_t mode ;   2145    __vki_kernel_mode_t mode ;
2146    unsigned short seq ;   2146    unsigned short seq ;
2147 };   2147 };
2148 struct vki_semid_ds {   2148 struct vki_semid_ds {
2149    struct vki_ipc_perm sem_perm ;   2149    struct vki_ipc_perm sem_perm ;
2150    __vki_kernel_time_t sem_otime ;   2150    __vki_kernel_time_t sem_otime ;
2151    __vki_kernel_time_t sem_ctime ;   2151    __vki_kernel_time_t sem_ctime ;
2152    void *sem_base ;   2152    void *sem_base ;
2153    void *sem_pending ;   2153    void *sem_pending ;
2154    void **sem_pending_last ;   2154    void **sem_pending_last ;
2155    void *undo ;   2155    void *undo ;
2156    unsigned short sem_nsems ;   2156    unsigned short sem_nsems ;
2157 };   2157 };
2158 struct vki_sembuf {   2158 struct vki_sembuf {
2159    unsigned short sem_num ;   2159    unsigned short sem_num ;
2160    short sem_op ;   2160    short sem_op ;
2161    short sem_flg ;   2161    short sem_flg ;
2162 };   2162 };
2163 struct vki_seminfo;   2163 struct vki_seminfo;
2164 union vki_semun {   2164 union vki_semun {
2165    int val ;   2165    int val ;
2166    struct vki_semid_ds *buf ;   2166    struct vki_semid_ds *buf ;
2167    unsigned short *array ;   2167    unsigned short *array ;
2168    struct vki_seminfo *__buf ;   2168    struct vki_seminfo *__buf ;
2169    void *__pad ;   2169    void *__pad ;
2170 };   2170 };
2171 struct vki_seminfo {   2171 struct vki_seminfo {
2172    int semmap ;   2172    int semmap ;
2173    int semmni ;   2173    int semmni ;
2174    int semmns ;   2174    int semmns ;
2175    int semmnu ;   2175    int semmnu ;
2176    int semmsl ;   2176    int semmsl ;
2177    int semopm ;   2177    int semopm ;
2178    int semume ;   2178    int semume ;
2179    int semusz ;   2179    int semusz ;
2180    int semvmx ;   2180    int semvmx ;
2181    int semaem ;   2181    int semaem ;
2182 };   2182 };
2183 struct vki_robust_list {   2183 struct vki_robust_list {
2184    struct vki_robust_list *next ;   2184    struct vki_robust_list *next ;
2185 };   2185 };
2186 struct vki_robust_list_head {   2186 struct vki_robust_list_head {
2187    struct vki_robust_list list ;   2187    struct vki_robust_list list ;
2188    long futex_offset ;   2188    long futex_offset ;
2189    struct vki_robust_list *list_op_pending ;   2189    struct vki_robust_list *list_op_pending ;
2190 };   2190 };
2191 struct vki_dirent {   2191 struct vki_dirent {
2192    long d_ino ;   2192    long d_ino ;
2193    __vki_kernel_off_t d_off ;   2193    __vki_kernel_off_t d_off ;
2194    unsigned short d_reclen ;   2194    unsigned short d_reclen ;
2195    char d_name[256] ;   2195    char d_name[256] ;
2196 };   2196 };
2197 struct __vki_sysctl_args {   2197 struct __vki_sysctl_args {
2198    int *name ;   2198    int *name ;
2199    int nlen ;   2199    int nlen ;
2200    void *oldval ;   2200    void *oldval ;
2201    vki_size_t *oldlenp ;   2201    vki_size_t *oldlenp ;
2202    void *newval ;   2202    void *newval ;
2203    vki_size_t newlen ;   2203    vki_size_t newlen ;
2204    unsigned long __unused[4] ;   2204    unsigned long __unused[4] ;
2205 };   2205 };
2206 typedef unsigned long vki_aio_context_t;   2206 typedef unsigned long vki_aio_context_t;
2207 enum __anonenum_83 {   2207 enum __anonenum_83 {
2208     VKI_IOCB_CMD_PREAD = 0,   2208     VKI_IOCB_CMD_PREAD = 0,
2209     VKI_IOCB_CMD_PWRITE = 1,   2209     VKI_IOCB_CMD_PWRITE = 1,
2210     VKI_IOCB_CMD_FSYNC = 2,   2210     VKI_IOCB_CMD_FSYNC = 2,
2211     VKI_IOCB_CMD_FDSYNC = 3,   2211     VKI_IOCB_CMD_FDSYNC = 3,
2212     VKI_IOCB_CMD_PREADV = 7,   2212     VKI_IOCB_CMD_PREADV = 7,
2213     VKI_IOCB_CMD_PWRITEV = 8   2213     VKI_IOCB_CMD_PWRITEV = 8
2214 } ;   2214 } ;
2215 struct vki_io_event {   2215 struct vki_io_event {
2216    __vki_u64 data ;   2216    __vki_u64 data ;
2217    __vki_u64 obj ;   2217    __vki_u64 obj ;
2218    __vki_s64 result ;   2218    __vki_s64 result ;
2219    __vki_s64 result2 ;   2219    __vki_s64 result2 ;
2220 };   2220 };
2221 struct vki_iocb {   2221 struct vki_iocb {
2222    __vki_u64 aio_data ;   2222    __vki_u64 aio_data ;
2223    __vki_u32 aio_key ;   2223    __vki_u32 aio_key ;
2224    __vki_u32 aio_reserved1 ;   2224    __vki_u32 aio_reserved1 ;
2225    __vki_u16 aio_lio_opcode ;   2225    __vki_u16 aio_lio_opcode ;
2226    __vki_s16 aio_reqprio ;   2226    __vki_s16 aio_reqprio ;
2227    __vki_u32 aio_fildes ;   2227    __vki_u32 aio_fildes ;
2228    __vki_u64 aio_buf ;   2228    __vki_u64 aio_buf ;
2229    __vki_u64 aio_nbytes ;   2229    __vki_u64 aio_nbytes ;
2230    __vki_s64 aio_offset ;   2230    __vki_s64 aio_offset ;
2231    __vki_u64 aio_reserved2 ;   2231    __vki_u64 aio_reserved2 ;
2232    __vki_u64 aio_reserved3 ;   2232    __vki_u64 aio_reserved3 ;
2233 };   2233 };
2234 struct vki_aio_ring {   2234 struct vki_aio_ring {
2235    unsigned int id ;   2235    unsigned int id ;
2236    unsigned int nr ;   2236    unsigned int nr ;
2237    unsigned int head ;   2237    unsigned int head ;
2238    unsigned int tail ;   2238    unsigned int tail ;
2239    unsigned int magic ;   2239    unsigned int magic ;
2240    unsigned int compat_features ;   2240    unsigned int compat_features ;
2241    unsigned int incompat_features ;   2241    unsigned int incompat_features ;
2242    unsigned int header_length ;   2242    unsigned int header_length ;
2243    struct vki_io_event io_events[0] ;   2243    struct vki_io_event io_events[0] ;
2244 };   2244 };
2245 struct vki_msg;   2245 struct vki_msg;
2246 struct vki_msqid_ds {   2246 struct vki_msqid_ds {
2247    struct vki_ipc_perm msg_perm ;   2247    struct vki_ipc_perm msg_perm ;
2248    struct vki_msg *msg_first ;   2248    struct vki_msg *msg_first ;
2249    struct vki_msg *msg_last ;   2249    struct vki_msg *msg_last ;
2250    __vki_kernel_time_t msg_stime ;   2250    __vki_kernel_time_t msg_stime ;
2251    __vki_kernel_time_t msg_rtime ;   2251    __vki_kernel_time_t msg_rtime ;
2252    __vki_kernel_time_t msg_ctime ;   2252    __vki_kernel_time_t msg_ctime ;
2253    unsigned long msg_lcbytes ;   2253    unsigned long msg_lcbytes ;
2254    unsigned long msg_lqbytes ;   2254    unsigned long msg_lqbytes ;
2255    unsigned short msg_cbytes ;   2255    unsigned short msg_cbytes ;
2256    unsigned short msg_qnum ;   2256    unsigned short msg_qnum ;
2257    unsigned short msg_qbytes ;   2257    unsigned short msg_qbytes ;
2258    __vki_kernel_ipc_pid_t msg_lspid ;   2258    __vki_kernel_ipc_pid_t msg_lspid ;
2259    __vki_kernel_ipc_pid_t msg_lrpid ;   2259    __vki_kernel_ipc_pid_t msg_lrpid ;
2260 };   2260 };
2261 struct vki_msgbuf {   2261 struct vki_msgbuf {
2262    long mtype ;   2262    long mtype ;
2263    char mtext[1] ;   2263    char mtext[1] ;
2264 };   2264 };
2265 struct vki_msginfo {   2265 struct vki_msginfo {
2266    int msgpool ;   2266    int msgpool ;
2267    int msgmap ;   2267    int msgmap ;
2268    int msgmax ;   2268    int msgmax ;
2269    int msgmnb ;   2269    int msgmnb ;
2270    int msgmni ;   2270    int msgmni ;
2271    int msgssz ;   2271    int msgssz ;
2272    int msgtql ;   2272    int msgtql ;
2273    unsigned short msgseg ;   2273    unsigned short msgseg ;
2274 };   2274 };
2275 struct vki_shmid_ds {   2275 struct vki_shmid_ds {
2276    struct vki_ipc_perm shm_perm ;   2276    struct vki_ipc_perm shm_perm ;
2277    int shm_segsz ;   2277    int shm_segsz ;
2278    __vki_kernel_time_t shm_atime ;   2278    __vki_kernel_time_t shm_atime ;
2279    __vki_kernel_time_t shm_dtime ;   2279    __vki_kernel_time_t shm_dtime ;
2280    __vki_kernel_time_t shm_ctime ;   2280    __vki_kernel_time_t shm_ctime ;
2281    __vki_kernel_ipc_pid_t shm_cpid ;   2281    __vki_kernel_ipc_pid_t shm_cpid ;
2282    __vki_kernel_ipc_pid_t shm_lpid ;   2282    __vki_kernel_ipc_pid_t shm_lpid ;
2283    unsigned short shm_nattch ;   2283    unsigned short shm_nattch ;
2284    unsigned short shm_unused ;   2284    unsigned short shm_unused ;
2285    void *shm_unused2 ;   2285    void *shm_unused2 ;
2286    void *shm_unused3 ;   2286    void *shm_unused3 ;
2287 };   2287 };
2288 struct vki_shminfo {   2288 struct vki_shminfo {
2289    int shmmax ;   2289    int shmmax ;
2290    int shmmin ;   2290    int shmmin ;
2291    int shmmni ;   2291    int shmmni ;
2292    int shmseg ;   2292    int shmseg ;
2293    int shmall ;   2293    int shmall ;
2294 };   2294 };
2295 struct vki_shm_info {   2295 struct vki_shm_info {
2296    int used_ids ;   2296    int used_ids ;
2297    unsigned long shm_tot ;   2297    unsigned long shm_tot ;
2298    unsigned long shm_rss ;   2298    unsigned long shm_rss ;
2299    unsigned long shm_swp ;   2299    unsigned long shm_swp ;
2300    unsigned long swap_attempts ;   2300    unsigned long swap_attempts ;
2301    unsigned long swap_successes ;   2301    unsigned long swap_successes ;
2302 };   2302 };
2303 struct vki_rtc_time {   2303 struct vki_rtc_time {
2304    int tm_sec ;   2304    int tm_sec ;
2305    int tm_min ;   2305    int tm_min ;
2306    int tm_hour ;   2306    int tm_hour ;
2307    int tm_mday ;   2307    int tm_mday ;
2308    int tm_mon ;   2308    int tm_mon ;
2309    int tm_year ;   2309    int tm_year ;
2310    int tm_wday ;   2310    int tm_wday ;
2311    int tm_yday ;   2311    int tm_yday ;
2312    int tm_isdst ;   2312    int tm_isdst ;
2313 };   2313 };
2314 struct __anonstruct_vki_isdn_net_ioctl_phone_84 {   2314 struct __anonstruct_vki_isdn_net_ioctl_phone_84 {
2315    char name[10] ;   2315    char name[10] ;
2316    char phone[32] ;   2316    char phone[32] ;
2317    int outgoing ;   2317    int outgoing ;
2318 };   2318 };
2319 typedef struct __anonstruct_vki_isdn_net_ioctl_phone_84 vki_isdn_net_ioctl_phone;   2319 typedef struct __anonstruct_vki_isdn_net_ioctl_phone_84 vki_isdn_net_ioctl_phone;
2320 struct vki_ppdev_frob_struct {   2320 struct vki_ppdev_frob_struct {
2321    unsigned char mask ;   2321    unsigned char mask ;
2322    unsigned char val ;   2322    unsigned char val ;
2323 };   2323 };
2324 struct vki_sg_io_hdr {   2324 struct vki_sg_io_hdr {
2325    int interface_id ;   2325    int interface_id ;
2326    int dxfer_direction ;   2326    int dxfer_direction ;
2327    unsigned char cmd_len ;   2327    unsigned char cmd_len ;
2328    unsigned char mx_sb_len ;   2328    unsigned char mx_sb_len ;
2329    unsigned short iovec_count ;   2329    unsigned short iovec_count ;
2330    unsigned int dxfer_len ;   2330    unsigned int dxfer_len ;
2331    void *dxferp ;   2331    void *dxferp ;
2332    unsigned char *cmdp ;   2332    unsigned char *cmdp ;
2333    void *sbp ;   2333    void *sbp ;
2334    unsigned int timeout ;   2334    unsigned int timeout ;
2335    unsigned int flags ;   2335    unsigned int flags ;
2336    int pack_id ;   2336    int pack_id ;
2337    void *usr_ptr ;   2337    void *usr_ptr ;
2338    unsigned char status ;   2338    unsigned char status ;
2339    unsigned char masked_status ;   2339    unsigned char masked_status ;
2340    unsigned char msg_status ;   2340    unsigned char msg_status ;
2341    unsigned char sb_len_wr ;   2341    unsigned char sb_len_wr ;
2342    unsigned short host_status ;   2342    unsigned short host_status ;
2343    unsigned short driver_status ;   2343    unsigned short driver_status ;
2344    int resid ;   2344    int resid ;
2345    unsigned int duration ;   2345    unsigned int duration ;
2346    unsigned int info ;   2346    unsigned int info ;
2347 };   2347 };
2348 typedef struct vki_sg_io_hdr vki_sg_io_hdr_t;   2348 typedef struct vki_sg_io_hdr vki_sg_io_hdr_t;
2349 struct vki_sg_scsi_id {   2349 struct vki_sg_scsi_id {
2350    int host_no ;   2350    int host_no ;
2351    int channel ;   2351    int channel ;
2352    int scsi_id ;   2352    int scsi_id ;
2353    int lun ;   2353    int lun ;
2354    int scsi_type ;   2354    int scsi_type ;
2355    short h_cmd_per_lun ;   2355    short h_cmd_per_lun ;
2356    short d_queue_depth ;   2356    short d_queue_depth ;
2357    int unused[2] ;   2357    int unused[2] ;
2358 };   2358 };
2359 typedef struct vki_sg_scsi_id vki_sg_scsi_id_t;   2359 typedef struct vki_sg_scsi_id vki_sg_scsi_id_t;
2360 struct vki_cdrom_msf0 {   2360 struct vki_cdrom_msf0 {
2361    __vki_u8 minute ;   2361    __vki_u8 minute ;
2362    __vki_u8 second ;   2362    __vki_u8 second ;
2363    __vki_u8 frame ;   2363    __vki_u8 frame ;
2364 };   2364 };
2365 union vki_cdrom_addr {   2365 union vki_cdrom_addr {
2366    struct vki_cdrom_msf0 msf ;   2366    struct vki_cdrom_msf0 msf ;
2367    int lba ;   2367    int lba ;
2368 };   2368 };
2369 struct vki_cdrom_msf {   2369 struct vki_cdrom_msf {
2370    __vki_u8 cdmsf_min0 ;   2370    __vki_u8 cdmsf_min0 ;
2371    __vki_u8 cdmsf_sec0 ;   2371    __vki_u8 cdmsf_sec0 ;
2372    __vki_u8 cdmsf_frame0 ;   2372    __vki_u8 cdmsf_frame0 ;
2373    __vki_u8 cdmsf_min1 ;   2373    __vki_u8 cdmsf_min1 ;
2374    __vki_u8 cdmsf_sec1 ;   2374    __vki_u8 cdmsf_sec1 ;
2375    __vki_u8 cdmsf_frame1 ;   2375    __vki_u8 cdmsf_frame1 ;
2376 };   2376 };
2377 struct vki_cdrom_tochdr {   2377 struct vki_cdrom_tochdr {
2378    __vki_u8 cdth_trk0 ;   2378    __vki_u8 cdth_trk0 ;
2379    __vki_u8 cdth_trk1 ;   2379    __vki_u8 cdth_trk1 ;
2380 };   2380 };
2381 struct vki_cdrom_volctrl {   2381 struct vki_cdrom_volctrl {
2382    __vki_u8 channel0 ;   2382    __vki_u8 channel0 ;
2383    __vki_u8 channel1 ;   2383    __vki_u8 channel1 ;
2384    __vki_u8 channel2 ;   2384    __vki_u8 channel2 ;
2385    __vki_u8 channel3 ;   2385    __vki_u8 channel3 ;
2386 };   2386 };
2387 struct vki_cdrom_subchnl {   2387 struct vki_cdrom_subchnl {
2388    __vki_u8 cdsc_format ;   2388    __vki_u8 cdsc_format ;
2389    __vki_u8 cdsc_audiostatus ;   2389    __vki_u8 cdsc_audiostatus ;
2390    __vki_u8 cdsc_adr : 4 ;   2390    __vki_u8 cdsc_adr : 4 ;
2391    __vki_u8 cdsc_ctrl : 4 ;   2391    __vki_u8 cdsc_ctrl : 4 ;
2392    __vki_u8 cdsc_trk ;   2392    __vki_u8 cdsc_trk ;
2393    __vki_u8 cdsc_ind ;   2393    __vki_u8 cdsc_ind ;
2394    union vki_cdrom_addr cdsc_absaddr ;   2394    union vki_cdrom_addr cdsc_absaddr ;
2395    union vki_cdrom_addr cdsc_reladdr ;   2395    union vki_cdrom_addr cdsc_reladdr ;
2396 };   2396 };
2397 struct vki_cdrom_tocentry {   2397 struct vki_cdrom_tocentry {
2398    __vki_u8 cdte_track ;   2398    __vki_u8 cdte_track ;
2399    __vki_u8 cdte_adr : 4 ;   2399    __vki_u8 cdte_adr : 4 ;
2400    __vki_u8 cdte_ctrl : 4 ;   2400    __vki_u8 cdte_ctrl : 4 ;
2401    __vki_u8 cdte_format ;   2401    __vki_u8 cdte_format ;
2402    union vki_cdrom_addr cdte_addr ;   2402    union vki_cdrom_addr cdte_addr ;
2403    __vki_u8 cdte_datamode ;   2403    __vki_u8 cdte_datamode ;
2404 };   2404 };
2405 struct vki_cdrom_read {   2405 struct vki_cdrom_read {
2406    int cdread_lba ;   2406    int cdread_lba ;
2407    char *cdread_bufaddr ;   2407    char *cdread_bufaddr ;
2408    int cdread_buflen ;   2408    int cdread_buflen ;
2409 };   2409 };
2410 struct vki_cdrom_read_audio {   2410 struct vki_cdrom_read_audio {
2411    union vki_cdrom_addr addr ;   2411    union vki_cdrom_addr addr ;
2412    __vki_u8 addr_format ;   2412    __vki_u8 addr_format ;
2413    int nframes ;   2413    int nframes ;
2414    __vki_u8 *buf ;   2414    __vki_u8 *buf ;
2415 };   2415 };
2416 struct vki_cdrom_multisession {   2416 struct vki_cdrom_multisession {
2417    union vki_cdrom_addr addr ;   2417    union vki_cdrom_addr addr ;
2418    __vki_u8 xa_flag ;   2418    __vki_u8 xa_flag ;
2419    __vki_u8 addr_format ;   2419    __vki_u8 addr_format ;
2420 };   2420 };
2421 struct vki_cdrom_mcn {   2421 struct vki_cdrom_mcn {
2422    __vki_u8 medium_catalog_number[14] ;   2422    __vki_u8 medium_catalog_number[14] ;
2423 };   2423 };
2424 struct vki_cdrom_generic_command {   2424 struct vki_cdrom_generic_command {
2425    unsigned char cmd[12] ;   2425    unsigned char cmd[12] ;
2426    unsigned char *buffer ;   2426    unsigned char *buffer ;
2427    unsigned int buflen ;   2427    unsigned int buflen ;
2428    int stat ;   2428    int stat ;
2429    void *sense ;   2429    void *sense ;
2430    unsigned char data_direction ;   2430    unsigned char data_direction ;
2431    int quiet ;   2431    int quiet ;
2432    int timeout ;   2432    int timeout ;
2433    void *reserved[1] ;   2433    void *reserved[1] ;
2434 };   2434 };
2435 struct vki_audio_buf_info {   2435 struct vki_audio_buf_info {
2436    int fragments ;   2436    int fragments ;
2437    int fragstotal ;   2437    int fragstotal ;
2438    int fragsize ;   2438    int fragsize ;
2439    int bytes ;   2439    int bytes ;
2440 };   2440 };
2441 typedef struct vki_audio_buf_info vki_audio_buf_info;   2441 typedef struct vki_audio_buf_info vki_audio_buf_info;
2442 struct vki_hd_geometry {   2442 struct vki_hd_geometry {
2443    unsigned char heads ;   2443    unsigned char heads ;
2444    unsigned char sectors ;   2444    unsigned char sectors ;
2445    unsigned short cylinders ;   2445    unsigned short cylinders ;
2446    unsigned long start ;   2446    unsigned long start ;
2447 };   2447 };
2448 struct vki_fb_fix_screeninfo {   2448 struct vki_fb_fix_screeninfo {
2449    char id[16] ;   2449    char id[16] ;
2450    unsigned long smem_start ;   2450    unsigned long smem_start ;
2451    __vki_u32 smem_len ;   2451    __vki_u32 smem_len ;
2452    __vki_u32 type ;   2452    __vki_u32 type ;
2453    __vki_u32 type_aux ;   2453    __vki_u32 type_aux ;
2454    __vki_u32 visual ;   2454    __vki_u32 visual ;
2455    __vki_u16 xpanstep ;   2455    __vki_u16 xpanstep ;
2456    __vki_u16 ypanstep ;   2456    __vki_u16 ypanstep ;
2457    __vki_u16 ywrapstep ;   2457    __vki_u16 ywrapstep ;
2458    __vki_u32 line_length ;   2458    __vki_u32 line_length ;
2459    unsigned long mmio_start ;   2459    unsigned long mmio_start ;
2460    __vki_u32 mmio_len ;   2460    __vki_u32 mmio_len ;
2461    __vki_u32 accel ;   2461    __vki_u32 accel ;
2462    __vki_u16 reserved[3] ;   2462    __vki_u16 reserved[3] ;
2463 };   2463 };
2464 struct vki_fb_bitfield {   2464 struct vki_fb_bitfield {
2465    __vki_u32 offset ;   2465    __vki_u32 offset ;
2466    __vki_u32 length ;   2466    __vki_u32 length ;
2467    __vki_u32 msb_right ;   2467    __vki_u32 msb_right ;
2468 };   2468 };
2469 struct vki_fb_var_screeninfo {   2469 struct vki_fb_var_screeninfo {
2470    __vki_u32 xres ;   2470    __vki_u32 xres ;
2471    __vki_u32 yres ;   2471    __vki_u32 yres ;
2472    __vki_u32 xres_virtual ;   2472    __vki_u32 xres_virtual ;
2473    __vki_u32 yres_virtual ;   2473    __vki_u32 yres_virtual ;
2474    __vki_u32 xoffset ;   2474    __vki_u32 xoffset ;
2475    __vki_u32 yoffset ;   2475    __vki_u32 yoffset ;
2476    __vki_u32 bits_per_pixel ;   2476    __vki_u32 bits_per_pixel ;
2477    __vki_u32 grayscale ;   2477    __vki_u32 grayscale ;
2478    struct vki_fb_bitfield red ;   2478    struct vki_fb_bitfield red ;
2479    struct vki_fb_bitfield green ;   2479    struct vki_fb_bitfield green ;
2480    struct vki_fb_bitfield blue ;   2480    struct vki_fb_bitfield blue ;
2481    struct vki_fb_bitfield transp ;   2481    struct vki_fb_bitfield transp ;
2482    __vki_u32 nonstd ;   2482    __vki_u32 nonstd ;
2483    __vki_u32 activate ;   2483    __vki_u32 activate ;
2484    __vki_u32 height ;   2484    __vki_u32 height ;
2485    __vki_u32 width ;   2485    __vki_u32 width ;
2486    __vki_u32 accel_flags ;   2486    __vki_u32 accel_flags ;
2487    __vki_u32 pixclock ;   2487    __vki_u32 pixclock ;
2488    __vki_u32 left_margin ;   2488    __vki_u32 left_margin ;
2489    __vki_u32 right_margin ;   2489    __vki_u32 right_margin ;
2490    __vki_u32 upper_margin ;   2490    __vki_u32 upper_margin ;
2491    __vki_u32 lower_margin ;   2491    __vki_u32 lower_margin ;
2492    __vki_u32 hsync_len ;   2492    __vki_u32 hsync_len ;
2493    __vki_u32 vsync_len ;   2493    __vki_u32 vsync_len ;
2494    __vki_u32 sync ;   2494    __vki_u32 sync ;
2495    __vki_u32 vmode ;   2495    __vki_u32 vmode ;
2496    __vki_u32 rotate ;   2496    __vki_u32 rotate ;
2497    __vki_u32 reserved[5] ;   2497    __vki_u32 reserved[5] ;
2498 };   2498 };
2499 struct vki_consolefontdesc {   2499 struct vki_consolefontdesc {
2500    unsigned short charcount ;   2500    unsigned short charcount ;
2501    unsigned short charheight ;   2501    unsigned short charheight ;
2502    char *chardata ;   2502    char *chardata ;
2503 };   2503 };
2504 struct vki_unipair {   2504 struct vki_unipair {
2505    unsigned short unicode ;   2505    unsigned short unicode ;
2506    unsigned short fontpos ;   2506    unsigned short fontpos ;
2507 };   2507 };
2508 struct vki_unimapdesc {   2508 struct vki_unimapdesc {
2509    unsigned short entry_ct ;   2509    unsigned short entry_ct ;
2510    struct vki_unipair *entries ;   2510    struct vki_unipair *entries ;
2511 };   2511 };
2512 struct vki_unimapinit {   2512 struct vki_unimapinit {
2513    unsigned short advised_hashsize ;   2513    unsigned short advised_hashsize ;
2514    unsigned short advised_hashstep ;   2514    unsigned short advised_hashstep ;
2515    unsigned short advised_hashlevel ;   2515    unsigned short advised_hashlevel ;
2516 };   2516 };
2517 struct vki_kbentry {   2517 struct vki_kbentry {
2518    unsigned char kb_table ;   2518    unsigned char kb_table ;
2519    unsigned char kb_index ;   2519    unsigned char kb_index ;
2520    unsigned short kb_value ;   2520    unsigned short kb_value ;
2521 };   2521 };
2522 struct vki_kbsentry {   2522 struct vki_kbsentry {
2523    unsigned char kb_func ;   2523    unsigned char kb_func ;
2524    unsigned char kb_string[512] ;   2524    unsigned char kb_string[512] ;
2525 };   2525 };
2526 struct vki_kbdiacr {   2526 struct vki_kbdiacr {
2527    unsigned char diacr ;   2527    unsigned char diacr ;
2528    unsigned char base ;   2528    unsigned char base ;
2529    unsigned char result ;   2529    unsigned char result ;
2530 };   2530 };
2531 struct vki_kbdiacrs {   2531 struct vki_kbdiacrs {
2532    unsigned int kb_cnt ;   2532    unsigned int kb_cnt ;
2533    struct vki_kbdiacr kbdiacr[256] ;   2533    struct vki_kbdiacr kbdiacr[256] ;
2534 };   2534 };
2535 struct vki_kbkeycode {   2535 struct vki_kbkeycode {
2536    unsigned int scancode ;   2536    unsigned int scancode ;
2537    unsigned int keycode ;   2537    unsigned int keycode ;
2538 };   2538 };
2539 struct vki_kbd_repeat {   2539 struct vki_kbd_repeat {
2540    int delay ;   2540    int delay ;
2541    int period ;   2541    int period ;
2542 };   2542 };
2543 struct vki_console_font_op {   2543 struct vki_console_font_op {
2544    unsigned int op ;   2544    unsigned int op ;
2545    unsigned int flags ;   2545    unsigned int flags ;
2546    unsigned int width ;   2546    unsigned int width ;
2547    unsigned int height ;   2547    unsigned int height ;
2548    unsigned int charcount ;   2548    unsigned int charcount ;
2549    unsigned char *data ;   2549    unsigned char *data ;
2550 };   2550 };
2551 typedef __vki_kernel_uid32_t vki_qid_t;   2551 typedef __vki_kernel_uid32_t vki_qid_t;
2552 struct __anonstruct_86 {   2552 struct __anonstruct_86 {
2553    int  : 0 ;   2553    int  : 0 ;
2554 };   2554 };
2555 struct __anonstruct_87 {   2555 struct __anonstruct_87 {
2556    int  : 0 ;   2556    int  : 0 ;
2557 };   2557 };
2558 enum __anonenum_85 {   2558 enum __anonenum_85 {
2559     VKI_SNDRV_PCM_IOCTL_HW_FREE = 16658,   2559     VKI_SNDRV_PCM_IOCTL_HW_FREE = 16658,
2560     VKI_SNDRV_PCM_IOCTL_HWSYNC = 16674,   2560     VKI_SNDRV_PCM_IOCTL_HWSYNC = 16674,
2561     VKI_SNDRV_PCM_IOCTL_PREPARE = 16704,   2561     VKI_SNDRV_PCM_IOCTL_PREPARE = 16704,
2562     VKI_SNDRV_PCM_IOCTL_RESET = 16705,   2562     VKI_SNDRV_PCM_IOCTL_RESET = 16705,
2563     VKI_SNDRV_PCM_IOCTL_START = 16706,   2563     VKI_SNDRV_PCM_IOCTL_START = 16706,
2564     VKI_SNDRV_PCM_IOCTL_DROP = 16707,   2564     VKI_SNDRV_PCM_IOCTL_DROP = 16707,
2565     VKI_SNDRV_PCM_IOCTL_DRAIN = 16708,   2565     VKI_SNDRV_PCM_IOCTL_DRAIN = 16708,
2566     VKI_SNDRV_PCM_IOCTL_PAUSE = 1074020677,   2566     VKI_SNDRV_PCM_IOCTL_PAUSE = 1074020677,
2567     VKI_SNDRV_PCM_IOCTL_RESUME = 16711,   2567     VKI_SNDRV_PCM_IOCTL_RESUME = 16711,
2568     VKI_SNDRV_PCM_IOCTL_XRUN = 16712,   2568     VKI_SNDRV_PCM_IOCTL_XRUN = 16712,
2569     VKI_SNDRV_PCM_IOCTL_LINK = 1074020704,   2569     VKI_SNDRV_PCM_IOCTL_LINK = 1074020704,
2570     VKI_SNDRV_PCM_IOCTL_UNLINK = 16737   2570     VKI_SNDRV_PCM_IOCTL_UNLINK = 16737
2571 } ;   2571 } ;
2572 enum __anonenum_88 {   2572 enum __anonenum_88 {
2573     VKI_SNDRV_TIMER_IOCTL_START = 21664,   2573     VKI_SNDRV_TIMER_IOCTL_START = 21664,
2574     VKI_SNDRV_TIMER_IOCTL_STOP = 21665,   2574     VKI_SNDRV_TIMER_IOCTL_STOP = 21665,
2575     VKI_SNDRV_TIMER_IOCTL_CONTINUE = 21666,   2575     VKI_SNDRV_TIMER_IOCTL_CONTINUE = 21666,
2576     VKI_SNDRV_TIMER_IOCTL_PAUSE = 21667   2576     VKI_SNDRV_TIMER_IOCTL_PAUSE = 21667
2577 } ;   2577 } ;
2578 struct vki_serial_icounter_struct {   2578 struct vki_serial_icounter_struct {
2579    int cts ;   2579    int cts ;
2580    int dsr ;   2580    int dsr ;
2581    int rng ;   2581    int rng ;
2582    int dcd ;   2582    int dcd ;
2583    int rx ;   2583    int rx ;
2584    int tx ;   2584    int tx ;
2585    int frame ;   2585    int frame ;
2586    int overrun ;   2586    int overrun ;
2587    int parity ;   2587    int parity ;
2588    int brk ;   2588    int brk ;
2589    int buf_overrun ;   2589    int buf_overrun ;
2590    int reserved[9] ;   2590    int reserved[9] ;
2591 };   2591 };
2592 struct vki_vt_mode {   2592 struct vki_vt_mode {
2593    char mode ;   2593    char mode ;
2594    char waitv ;   2594    char waitv ;
2595    short relsig ;   2595    short relsig ;
2596    short acqsig ;   2596    short acqsig ;
2597    short frsig ;   2597    short frsig ;
2598 };   2598 };
2599 struct vki_vt_stat {   2599 struct vki_vt_stat {
2600    unsigned short v_active ;   2600    unsigned short v_active ;
2601    unsigned short v_signal ;   2601    unsigned short v_signal ;
2602    unsigned short v_state ;   2602    unsigned short v_state ;
2603 };   2603 };
2604 struct vki_vt_sizes {   2604 struct vki_vt_sizes {
2605    unsigned short v_rows ;   2605    unsigned short v_rows ;
2606    unsigned short v_cols ;   2606    unsigned short v_cols ;
2607    unsigned short v_scrollsize ;   2607    unsigned short v_scrollsize ;
2608 };   2608 };
2609 struct vki_vt_consize {   2609 struct vki_vt_consize {
2610    unsigned short v_rows ;   2610    unsigned short v_rows ;
2611    unsigned short v_cols ;   2611    unsigned short v_cols ;
2612    unsigned short v_vlin ;   2612    unsigned short v_vlin ;
2613    unsigned short v_clin ;   2613    unsigned short v_clin ;
2614    unsigned short v_vcol ;   2614    unsigned short v_vcol ;
2615    unsigned short v_ccol ;   2615    unsigned short v_ccol ;
2616 };   2616 };
2617 struct vki_usbdevfs_ctrltransfer {   2617 struct vki_usbdevfs_ctrltransfer {
2618    __vki_u8 bRequestType ;   2618    __vki_u8 bRequestType ;
2619    __vki_u8 bRequest ;   2619    __vki_u8 bRequest ;
2620    __vki_u16 wValue ;   2620    __vki_u16 wValue ;
2621    __vki_u16 wIndex ;   2621    __vki_u16 wIndex ;
2622    __vki_u16 wLength ;   2622    __vki_u16 wLength ;
2623    __vki_u32 timeout ;   2623    __vki_u32 timeout ;
2624    void *data ;   2624    void *data ;
2625 };   2625 };
2626 struct vki_usbdevfs_bulktransfer {   2626 struct vki_usbdevfs_bulktransfer {
2627    unsigned int ep ;   2627    unsigned int ep ;
2628    unsigned int len ;   2628    unsigned int len ;
2629    unsigned int timeout ;   2629    unsigned int timeout ;
2630    void *data ;   2630    void *data ;
2631 };   2631 };
2632 struct vki_usbdevfs_getdriver {   2632 struct vki_usbdevfs_getdriver {
2633    unsigned int interface ;   2633    unsigned int interface ;
2634    char driver[256] ;   2634    char driver[256] ;
2635 };   2635 };
2636 struct vki_usbdevfs_connectinfo {   2636 struct vki_usbdevfs_connectinfo {
2637    unsigned int devnum ;   2637    unsigned int devnum ;
2638    unsigned char slow ;   2638    unsigned char slow ;
2639 };   2639 };
2640 struct vki_usbdevfs_iso_packet_desc {   2640 struct vki_usbdevfs_iso_packet_desc {
2641    unsigned int length ;   2641    unsigned int length ;
2642    unsigned int actual_length ;   2642    unsigned int actual_length ;
2643    unsigned int status ;   2643    unsigned int status ;
2644 };   2644 };
2645 struct vki_usbdevfs_urb {   2645 struct vki_usbdevfs_urb {
2646    unsigned char type ;   2646    unsigned char type ;
2647    unsigned char endpoint ;   2647    unsigned char endpoint ;
2648    int status ;   2648    int status ;
2649    unsigned int flags ;   2649    unsigned int flags ;
2650    void *buffer ;   2650    void *buffer ;
2651    int buffer_length ;   2651    int buffer_length ;
2652    int actual_length ;   2652    int actual_length ;
2653    int start_frame ;   2653    int start_frame ;
2654    int number_of_packets ;   2654    int number_of_packets ;
2655    int error_count ;   2655    int error_count ;
2656    unsigned int signr ;   2656    unsigned int signr ;
2657    void *usercontext ;   2657    void *usercontext ;
2658    struct vki_usbdevfs_iso_packet_desc iso_frame_desc[0] ;   2658    struct vki_usbdevfs_iso_packet_desc iso_frame_desc[0] ;
2659 };   2659 };
2660 struct vki_usbdevfs_ioctl {   2660 struct vki_usbdevfs_ioctl {
2661    int ifno ;   2661    int ifno ;
2662    int ioctl_code ;   2662    int ioctl_code ;
2663    void *data ;   2663    void *data ;
2664 };   2664 };
2665 struct vki_usbdevfs_setuppacket {   2665 struct vki_usbdevfs_setuppacket {
2666    __vki_u8 bRequestType ;   2666    __vki_u8 bRequestType ;
2667    __vki_u8 bRequest ;   2667    __vki_u8 bRequest ;
2668    __vki_u16 wValue ;   2668    __vki_u16 wValue ;
2669    __vki_u16 wIndex ;   2669    __vki_u16 wIndex ;
2670    __vki_u16 wLength ;   2670    __vki_u16 wLength ;
2671 };   2671 };
2672 typedef vki_int32_t vki_key_serial_t;   2672 typedef vki_int32_t vki_key_serial_t;
2673 typedef vki_uint32_t vki_key_perm_t;   2673 typedef vki_uint32_t vki_key_perm_t;
2674 struct vki_iw_param {   2674 struct vki_iw_param {
2675    __vki_s32 value ;   2675    __vki_s32 value ;
2676    __vki_u8 fixed ;   2676    __vki_u8 fixed ;
2677    __vki_u8 disabled ;   2677    __vki_u8 disabled ;
2678    __vki_u16 flags ;   2678    __vki_u16 flags ;
2679 };   2679 };
2680 struct vki_iw_point {   2680 struct vki_iw_point {
2681    void *pointer ;   2681    void *pointer ;
2682    __vki_u16 length ;   2682    __vki_u16 length ;
2683    __vki_u16 flags ;   2683    __vki_u16 flags ;
2684 };   2684 };
2685 struct vki_iw_freq {   2685 struct vki_iw_freq {
2686    __vki_s32 m ;   2686    __vki_s32 m ;
2687    __vki_s16 e ;   2687    __vki_s16 e ;
2688    __vki_u8 i ;   2688    __vki_u8 i ;
2689    __vki_u8 flags ;   2689    __vki_u8 flags ;
2690 };   2690 };
2691 struct vki_iw_quality {   2691 struct vki_iw_quality {
2692    __vki_u8 qual ;   2692    __vki_u8 qual ;
2693    __vki_u8 level ;   2693    __vki_u8 level ;
2694    __vki_u8 noise ;   2694    __vki_u8 noise ;
2695    __vki_u8 updated ;   2695    __vki_u8 updated ;
2696 };   2696 };
2697 union vki_iwreq_data {   2697 union vki_iwreq_data {
2698    char name[16] ;   2698    char name[16] ;
2699    struct vki_iw_point essid ;   2699    struct vki_iw_point essid ;
2700    struct vki_iw_param nwid ;   2700    struct vki_iw_param nwid ;
2701    struct vki_iw_freq freq ;   2701    struct vki_iw_freq freq ;
2702    struct vki_iw_param sens ;   2702    struct vki_iw_param sens ;
2703    struct vki_iw_param bitrate ;   2703    struct vki_iw_param bitrate ;
2704    struct vki_iw_param txpower ;   2704    struct vki_iw_param txpower ;
2705    struct vki_iw_param rts ;   2705    struct vki_iw_param rts ;
2706    struct vki_iw_param frag ;   2706    struct vki_iw_param frag ;
2707    __vki_u32 mode ;   2707    __vki_u32 mode ;
2708    struct vki_iw_param retry ;   2708    struct vki_iw_param retry ;
2709    struct vki_iw_point encoding ;   2709    struct vki_iw_point encoding ;
2710    struct vki_iw_param power ;   2710    struct vki_iw_param power ;
2711    struct vki_iw_quality qual ;   2711    struct vki_iw_quality qual ;
2712    struct vki_sockaddr ap_addr ;   2712    struct vki_sockaddr ap_addr ;
2713    struct vki_sockaddr addr ;   2713    struct vki_sockaddr addr ;
2714    struct vki_iw_param param ;   2714    struct vki_iw_param param ;
2715    struct vki_iw_point data ;   2715    struct vki_iw_point data ;
2716 };   2716 };
2717 union __anonunion_ifr_ifrn_89 {   2717 union __anonunion_ifr_ifrn_89 {
2718    char ifrn_name[16] ;   2718    char ifrn_name[16] ;
2719 };   2719 };
2720 struct vki_iwreq {   2720 struct vki_iwreq {
2721    union __anonunion_ifr_ifrn_89 ifr_ifrn ;   2721    union __anonunion_ifr_ifrn_89 ifr_ifrn ;
2722    union vki_iwreq_data u ;   2722    union vki_iwreq_data u ;
2723 };   2723 };
2724 union __anonunion____missing_field_name_90 {   2724 union __anonunion____missing_field_name_90 {
2725    __vki_u64 sample_period ;   2725    __vki_u64 sample_period ;
2726    __vki_u64 sample_freq ;   2726    __vki_u64 sample_freq ;
2727 };   2727 };
2728 struct vki_perf_counter_attr {   2728 struct vki_perf_counter_attr {
2729    __vki_u32 type ;   2729    __vki_u32 type ;
2730    __vki_u32 size ;   2730    __vki_u32 size ;
2731    __vki_u64 config ;   2731    __vki_u64 config ;
2732    union __anonunion____missing_field_name_90 __annonCompField1 ;   2732    union __anonunion____missing_field_name_90 __annonCompField1 ;
2733    __vki_u64 sample_type ;   2733    __vki_u64 sample_type ;
2734    __vki_u64 read_format ;   2734    __vki_u64 read_format ;
2735    __vki_u64 disabled : 1 ;   2735    __vki_u64 disabled : 1 ;
2736    __vki_u64 inherit : 1 ;   2736    __vki_u64 inherit : 1 ;
2737    __vki_u64 pinned : 1 ;   2737    __vki_u64 pinned : 1 ;
2738    __vki_u64 exclusive : 1 ;   2738    __vki_u64 exclusive : 1 ;
2739    __vki_u64 exclude_user : 1 ;   2739    __vki_u64 exclude_user : 1 ;
2740    __vki_u64 exclude_kernel : 1 ;   2740    __vki_u64 exclude_kernel : 1 ;
2741    __vki_u64 exclude_hv : 1 ;   2741    __vki_u64 exclude_hv : 1 ;
2742    __vki_u64 exclude_idle : 1 ;   2742    __vki_u64 exclude_idle : 1 ;
2743    __vki_u64 mmap : 1 ;   2743    __vki_u64 mmap : 1 ;
2744    __vki_u64 comm : 1 ;   2744    __vki_u64 comm : 1 ;
2745    __vki_u64 freq : 1 ;   2745    __vki_u64 freq : 1 ;
2746    __vki_u64 inherit_stat : 1 ;   2746    __vki_u64 inherit_stat : 1 ;
2747    __vki_u64 enable_on_exec : 1 ;   2747    __vki_u64 enable_on_exec : 1 ;
2748    __vki_u64 task : 1 ;   2748    __vki_u64 task : 1 ;
2749    __vki_u64 __reserved_1 : 50 ;   2749    __vki_u64 __reserved_1 : 50 ;
2750    __vki_u32 wakeup_events ;   2750    __vki_u32 wakeup_events ;
2751    __vki_u32 __reserved_2 ;   2751    __vki_u32 __reserved_2 ;
2752    __vki_u64 __reserved_3 ;   2752    __vki_u64 __reserved_3 ;
2753 };   2753 };
2754 struct vki_getcpu_cache {   2754 struct vki_getcpu_cache {
2755    unsigned long blob[128U / sizeof(long )] ;   2755    unsigned long blob[128U / sizeof(long )] ;
2756 };   2756 };
2757 typedef void (*vg_atfork_t)(ThreadId  );   2757 typedef void (*vg_atfork_t)(ThreadId  );
2758 enum __anonenum_SegKind_91 {   2758 enum __anonenum_SegKind_91 {
2759     SkFree = 0,   2759     SkFree = 0,
2760     SkAnonC = 1,   2760     SkAnonC = 1,
2761     SkAnonV = 2,   2761     SkAnonV = 2,
2762     SkFileC = 3,   2762     SkFileC = 3,
2763     SkFileV = 4,   2763     SkFileV = 4,
2764     SkShmC = 5,   2764     SkShmC = 5,
2765     SkResvn = 6   2765     SkResvn = 6
2766 } ;   2766 } ;
2767 typedef enum __anonenum_SegKind_91 SegKind;   2767 typedef enum __anonenum_SegKind_91 SegKind;
2768 enum __anonenum_ShrinkMode_92 {   2768 enum __anonenum_ShrinkMode_92 {
2769     SmLower = 0,   2769     SmLower = 0,
2770     SmFixed = 1,   2770     SmFixed = 1,
2771     SmUpper = 2   2771     SmUpper = 2
2772 } ;   2772 } ;
2773 typedef enum __anonenum_ShrinkMode_92 ShrinkMode;   2773 typedef enum __anonenum_ShrinkMode_92 ShrinkMode;
2774 struct __anonstruct_NSegment_93 {   2774 struct __anonstruct_NSegment_93 {
2775    SegKind kind ;   2775    SegKind kind ;
2776    Addr start ;   2776    Addr start ;
2777    Addr end ;   2777    Addr end ;
2778    ShrinkMode smode ;   2778    ShrinkMode smode ;
2779    ULong dev ;   2779    ULong dev ;
2780    ULong ino ;   2780    ULong ino ;
2781    Off64T offset ;   2781    Off64T offset ;
2782    UInt mode ;   2782    UInt mode ;
2783    Int fnIdx ;   2783    Int fnIdx ;
2784    Bool hasR ;   2784    Bool hasR ;
2785    Bool hasW ;   2785    Bool hasW ;
2786    Bool hasX ;   2786    Bool hasX ;
2787    Bool hasT ;   2787    Bool hasT ;
2788    Bool isCH ;   2788    Bool isCH ;
2789    Bool mark ;   2789    Bool mark ;
2790 };   2790 };
2791 typedef struct __anonstruct_NSegment_93 NSegment;   2791 typedef struct __anonstruct_NSegment_93 NSegment;
2792 struct _WordSetU;   2792 struct _WordSetU;
2793 typedef struct _WordSetU WordSetU;   2793 typedef struct _WordSetU WordSetU;
2794 typedef UInt WordSet;   2794 typedef UInt WordSet;
2795 typedef WordSet WordSetID;   2795 typedef WordSet WordSetID;
2796 struct _SO;   2796 struct _SO;
2797 typedef struct _SO SO;   2797 typedef struct _SO SO;
2798 struct _Thr;   2798 struct _Thr;
2799 typedef struct _Thr Thr;   2799 typedef struct _Thr Thr;
2800 typedef UInt ThrID;   2800 typedef UInt ThrID;
2801 struct _Thread {   2801 struct _Thread {
2802    struct _Thread *admin ;   2802    struct _Thread *admin ;
2803    UInt magic ;   2803    UInt magic ;
2804    Thr *hbthr ;   2804    Thr *hbthr ;
2805    ThreadId coretid ;   2805    ThreadId coretid ;
2806    WordSetID locksetA ;   2806    WordSetID locksetA ;
2807    WordSetID locksetW ;   2807    WordSetID locksetW ;
2808    ExeContext *created_at ;   2808    ExeContext *created_at ;
2809    Bool announced ;   2809    Bool announced ;
2810    Int errmsg_index ;   2810    Int errmsg_index ;
2811 };   2811 };
2812 typedef struct _Thread Thread;   2812 typedef struct _Thread Thread;
2813 enum __anonenum_LockKind_94 {   2813 enum __anonenum_LockKind_94 {
2814     LK_mbRec = 1001,   2814     LK_mbRec = 1001,
2815     LK_nonRec = 1002,   2815     LK_nonRec = 1002,
2816     LK_rdwr = 1003   2816     LK_rdwr = 1003
2817 } ;   2817 } ;
2818 typedef enum __anonenum_LockKind_94 LockKind;   2818 typedef enum __anonenum_LockKind_94 LockKind;
2819 struct _Lock {   2819 struct _Lock {
2820    struct _Lock *admin_next ;   2820    struct _Lock *admin_next ;
2821    struct _Lock *admin_prev ;   2821    struct _Lock *admin_prev ;
2822    ULong unique ;   2822    ULong unique ;
2823    UInt magic ;   2823    UInt magic ;
2824    ExeContext *appeared_at ;   2824    ExeContext *appeared_at ;
2825    ExeContext *acquired_at ;   2825    ExeContext *acquired_at ;
2826    SO *hbso ;   2826    SO *hbso ;
2827    Addr guestaddr ;   2827    Addr guestaddr ;
2828    LockKind kind ;   2828    LockKind kind ;
2829    Bool heldW ;   2829    Bool heldW ;
2830    WordBag *heldBy ;   2830    WordBag *heldBy ;
2831 };   2831 };
2832 typedef struct _Lock Lock;   2832 typedef struct _Lock Lock;
2833 struct __anonstruct_OrigFn_95 {   2833 struct __anonstruct_OrigFn_95 {
2834    unsigned int nraddr ;   2834    unsigned int nraddr ;
2835 };   2835 };
2836 typedef struct __anonstruct_OrigFn_95 OrigFn;   2836 typedef struct __anonstruct_OrigFn_95 OrigFn;
2837 enum __anonenum_Vg_ClientRequest_96 {   2837 enum __anonenum_Vg_ClientRequest_96 {
2838     VG_USERREQ__RUNNING_ON_VALGRIND = 4097,   2838     VG_USERREQ__RUNNING_ON_VALGRIND = 4097,
2839     VG_USERREQ__DISCARD_TRANSLATIONS = 4098,   2839     VG_USERREQ__DISCARD_TRANSLATIONS = 4098,
2840     VG_USERREQ__CLIENT_CALL0 = 4353,   2840     VG_USERREQ__CLIENT_CALL0 = 4353,
2841     VG_USERREQ__CLIENT_CALL1 = 4354,   2841     VG_USERREQ__CLIENT_CALL1 = 4354,
2842     VG_USERREQ__CLIENT_CALL2 = 4355,   2842     VG_USERREQ__CLIENT_CALL2 = 4355,
2843     VG_USERREQ__CLIENT_CALL3 = 4356,   2843     VG_USERREQ__CLIENT_CALL3 = 4356,
2844     VG_USERREQ__COUNT_ERRORS = 4609,   2844     VG_USERREQ__COUNT_ERRORS = 4609,
2845     VG_USERREQ__MALLOCLIKE_BLOCK = 4865,   2845     VG_USERREQ__MALLOCLIKE_BLOCK = 4865,
2846     VG_USERREQ__FREELIKE_BLOCK = 4866,   2846     VG_USERREQ__FREELIKE_BLOCK = 4866,
2847     VG_USERREQ__CREATE_MEMPOOL = 4867,   2847     VG_USERREQ__CREATE_MEMPOOL = 4867,
2848     VG_USERREQ__DESTROY_MEMPOOL = 4868,   2848     VG_USERREQ__DESTROY_MEMPOOL = 4868,
2849     VG_USERREQ__MEMPOOL_ALLOC = 4869,   2849     VG_USERREQ__MEMPOOL_ALLOC = 4869,
2850     VG_USERREQ__MEMPOOL_FREE = 4870,   2850     VG_USERREQ__MEMPOOL_FREE = 4870,
2851     VG_USERREQ__MEMPOOL_TRIM = 4871,   2851     VG_USERREQ__MEMPOOL_TRIM = 4871,
2852     VG_USERREQ__MOVE_MEMPOOL = 4872,   2852     VG_USERREQ__MOVE_MEMPOOL = 4872,
2853     VG_USERREQ__MEMPOOL_CHANGE = 4873,   2853     VG_USERREQ__MEMPOOL_CHANGE = 4873,
2854     VG_USERREQ__MEMPOOL_EXISTS = 4874,   2854     VG_USERREQ__MEMPOOL_EXISTS = 4874,
2855     VG_USERREQ__PRINTF = 5121,   2855     VG_USERREQ__PRINTF = 5121,
2856     VG_USERREQ__PRINTF_BACKTRACE = 5122,   2856     VG_USERREQ__PRINTF_BACKTRACE = 5122,
2857     VG_USERREQ__PRINTF_VALIST_BY_REF = 5123,   2857     VG_USERREQ__PRINTF_VALIST_BY_REF = 5123,
2858     VG_USERREQ__PRINTF_BACKTRACE_VALIST_BY_REF = 5124,   2858     VG_USERREQ__PRINTF_BACKTRACE_VALIST_BY_REF = 5124,
2859     VG_USERREQ__STACK_REGISTER = 5377,   2859     VG_USERREQ__STACK_REGISTER = 5377,
2860     VG_USERREQ__STACK_DEREGISTER = 5378,   2860     VG_USERREQ__STACK_DEREGISTER = 5378,
2861     VG_USERREQ__STACK_CHANGE = 5379,   2861     VG_USERREQ__STACK_CHANGE = 5379,
2862     VG_USERREQ__LOAD_PDB_DEBUGINFO = 5633,   2862     VG_USERREQ__LOAD_PDB_DEBUGINFO = 5633,
2863     VG_USERREQ__MAP_IP_TO_SRCLOC = 5889   2863     VG_USERREQ__MAP_IP_TO_SRCLOC = 5889
2864 } ;   2864 } ;
2865 typedef enum __anonenum_Vg_ClientRequest_96 Vg_ClientRequest;   2865 typedef enum __anonenum_Vg_ClientRequest_96 Vg_ClientRequest;
2866 enum __anonenum_Vg_TCheckClientRequest_97 {   2866 enum __anonenum_Vg_TCheckClientRequest_97 {
2867     VG_USERREQ__HG_CLEAN_MEMORY = 1212612608,   2867     VG_USERREQ__HG_CLEAN_MEMORY = 1212612608,
2868     _VG_USERREQ__HG_SET_MY_PTHREAD_T = 1212612864,   2868     _VG_USERREQ__HG_SET_MY_PTHREAD_T = 1212612864,
2869     _VG_USERREQ__HG_PTH_API_ERROR = 1212612865,   2869     _VG_USERREQ__HG_PTH_API_ERROR = 1212612865,
2870     _VG_USERREQ__HG_PTHREAD_JOIN_POST = 1212612866,   2870     _VG_USERREQ__HG_PTHREAD_JOIN_POST = 1212612866,
2871     _VG_USERREQ__HG_PTHREAD_MUTEX_INIT_POST = 1212612867,   2871     _VG_USERREQ__HG_PTHREAD_MUTEX_INIT_POST = 1212612867,
2872     _VG_USERREQ__HG_PTHREAD_MUTEX_DESTROY_PRE = 1212612868,   2872     _VG_USERREQ__HG_PTHREAD_MUTEX_DESTROY_PRE = 1212612868,
2873     _VG_USERREQ__HG_PTHREAD_MUTEX_UNLOCK_PRE = 1212612869,   2873     _VG_USERREQ__HG_PTHREAD_MUTEX_UNLOCK_PRE = 1212612869,
2874     _VG_USERREQ__HG_PTHREAD_MUTEX_UNLOCK_POST = 1212612870,   2874     _VG_USERREQ__HG_PTHREAD_MUTEX_UNLOCK_POST = 1212612870,
2875     _VG_USERREQ__HG_PTHREAD_MUTEX_LOCK_PRE = 1212612871,   2875     _VG_USERREQ__HG_PTHREAD_MUTEX_LOCK_PRE = 1212612871,
2876     _VG_USERREQ__HG_PTHREAD_MUTEX_LOCK_POST = 1212612872,   2876     _VG_USERREQ__HG_PTHREAD_MUTEX_LOCK_POST = 1212612872,
2877     _VG_USERREQ__HG_PTHREAD_COND_SIGNAL_PRE = 1212612873,   2877     _VG_USERREQ__HG_PTHREAD_COND_SIGNAL_PRE = 1212612873,
2878     _VG_USERREQ__HG_PTHREAD_COND_BROADCAST_PRE = 1212612874,   2878     _VG_USERREQ__HG_PTHREAD_COND_BROADCAST_PRE = 1212612874,
2879     _VG_USERREQ__HG_PTHREAD_COND_WAIT_PRE = 1212612875,   2879     _VG_USERREQ__HG_PTHREAD_COND_WAIT_PRE = 1212612875,
2880     _VG_USERREQ__HG_PTHREAD_COND_WAIT_POST = 1212612876,   2880     _VG_USERREQ__HG_PTHREAD_COND_WAIT_POST = 1212612876,
2881     _VG_USERREQ__HG_PTHREAD_COND_DESTROY_PRE = 1212612877,   2881     _VG_USERREQ__HG_PTHREAD_COND_DESTROY_PRE = 1212612877,
2882     _VG_USERREQ__HG_PTHREAD_RWLOCK_INIT_POST = 1212612878,   2882     _VG_USERREQ__HG_PTHREAD_RWLOCK_INIT_POST = 1212612878,
2883     _VG_USERREQ__HG_PTHREAD_RWLOCK_DESTROY_PRE = 1212612879,   2883     _VG_USERREQ__HG_PTHREAD_RWLOCK_DESTROY_PRE = 1212612879,
2884     _VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_PRE = 1212612880,   2884     _VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_PRE = 1212612880,
2885     _VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_POST = 1212612881,   2885     _VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_POST = 1212612881,
2886     _VG_USERREQ__HG_PTHREAD_RWLOCK_UNLOCK_PRE = 1212612882,   2886     _VG_USERREQ__HG_PTHREAD_RWLOCK_UNLOCK_PRE = 1212612882,
2887     _VG_USERREQ__HG_PTHREAD_RWLOCK_UNLOCK_POST = 1212612883,   2887     _VG_USERREQ__HG_PTHREAD_RWLOCK_UNLOCK_POST = 1212612883,
2888     _VG_USERREQ__HG_POSIX_SEM_INIT_POST = 1212612884,   2888     _VG_USERREQ__HG_POSIX_SEM_INIT_POST = 1212612884,
2889     _VG_USERREQ__HG_POSIX_SEM_DESTROY_PRE = 1212612885,   2889     _VG_USERREQ__HG_POSIX_SEM_DESTROY_PRE = 1212612885,
2890     _VG_USERREQ__HG_POSIX_SEM_POST_PRE = 1212612886,   2890     _VG_USERREQ__HG_POSIX_SEM_POST_PRE = 1212612886,
2891     _VG_USERREQ__HG_POSIX_SEM_WAIT_POST = 1212612887,   2891     _VG_USERREQ__HG_POSIX_SEM_WAIT_POST = 1212612887,
2892     _VG_USERREQ__HG_PTHREAD_BARRIER_INIT_PRE = 1212612888,   2892     _VG_USERREQ__HG_PTHREAD_BARRIER_INIT_PRE = 1212612888,
2893     _VG_USERREQ__HG_PTHREAD_BARRIER_WAIT_PRE = 1212612889,   2893     _VG_USERREQ__HG_PTHREAD_BARRIER_WAIT_PRE = 1212612889,
2894     _VG_USERREQ__HG_PTHREAD_BARRIER_DESTROY_PRE = 1212612890,   2894     _VG_USERREQ__HG_PTHREAD_BARRIER_DESTROY_PRE = 1212612890,
2895     _VG_USERREQ__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_PRE = 1212612891,   2895     _VG_USERREQ__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_PRE = 1212612891,
2896     _VG_USERREQ__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_POST = 1212612892,   2896     _VG_USERREQ__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_POST = 1212612892,
2897     _VG_USERREQ__HG_PTHREAD_SPIN_LOCK_PRE = 1212612893,   2897     _VG_USERREQ__HG_PTHREAD_SPIN_LOCK_PRE = 1212612893,
2898     _VG_USERREQ__HG_PTHREAD_SPIN_LOCK_POST = 1212612894,   2898     _VG_USERREQ__HG_PTHREAD_SPIN_LOCK_POST = 1212612894,
2899     _VG_USERREQ__HG_PTHREAD_SPIN_DESTROY_PRE = 1212612895,   2899     _VG_USERREQ__HG_PTHREAD_SPIN_DESTROY_PRE = 1212612895,
2900     _VG_USERREQ__HG_CLIENTREQ_UNIMP = 1212612896,   2900     _VG_USERREQ__HG_CLIENTREQ_UNIMP = 1212612896,
2901     _VG_USERREQ__HG_USERSO_SEND_PRE = 1212612897,   2901     _VG_USERREQ__HG_USERSO_SEND_PRE = 1212612897,
2902     _VG_USERREQ__HG_USERSO_RECV_POST = 1212612898,   2902     _VG_USERREQ__HG_USERSO_RECV_POST = 1212612898,
2903     _VG_USERREQ__HG_USERSO_FORGET_ALL = 1212612899,   2903     _VG_USERREQ__HG_USERSO_FORGET_ALL = 1212612899,
2904     _VG_USERREQ__HG_RESERVED2 = 1212612900,   2904     _VG_USERREQ__HG_RESERVED2 = 1212612900,
2905     _VG_USERREQ__HG_RESERVED3 = 1212612901,   2905     _VG_USERREQ__HG_RESERVED3 = 1212612901,
2906     _VG_USERREQ__HG_RESERVED4 = 1212612902,   2906     _VG_USERREQ__HG_RESERVED4 = 1212612902,
2907     _VG_USERREQ__HG_ARANGE_MAKE_UNTRACKED = 1212612903,   2907     _VG_USERREQ__HG_ARANGE_MAKE_UNTRACKED = 1212612903,
2908     _VG_USERREQ__HG_ARANGE_MAKE_TRACKED = 1212612904,   2908     _VG_USERREQ__HG_ARANGE_MAKE_TRACKED = 1212612904,
2909     _VG_USERREQ__HG_PTHREAD_BARRIER_RESIZE_PRE = 1212612905,   2909     _VG_USERREQ__HG_PTHREAD_BARRIER_RESIZE_PRE = 1212612905,
2910     _VG_USERREQ__HG_CLEAN_MEMORY_HEAPBLOCK = 1212612906   2910     _VG_USERREQ__HG_CLEAN_MEMORY_HEAPBLOCK = 1212612906
2911 } ;   2911 } ;
2912 typedef enum __anonenum_Vg_TCheckClientRequest_97 Vg_TCheckClientRequest;   2912 typedef enum __anonenum_Vg_TCheckClientRequest_97 Vg_TCheckClientRequest;
2913 struct __anonstruct_CVInfo_98 {   2913 struct __anonstruct_CVInfo_98 {
2914    SO *so ;   2914    SO *so ;
2915    void *mx_ga ;   2915    void *mx_ga ;
2916    UWord nWaiters ;   2916    UWord nWaiters ;
2917 };   2917 };
2918 typedef struct __anonstruct_CVInfo_98 CVInfo;   2918 typedef struct __anonstruct_CVInfo_98 CVInfo;
2919 struct __anonstruct_Bar_99 {   2919 struct __anonstruct_Bar_99 {
2920    Bool initted ;   2920    Bool initted ;
2921    Bool resizable ;   2921    Bool resizable ;
2922    UWord size ;   2922    UWord size ;
2923    XArray *waiting ;   2923    XArray *waiting ;
2924 };   2924 };
2925 typedef struct __anonstruct_Bar_99 Bar;   2925 typedef struct __anonstruct_Bar_99 Bar;
2926 struct __anonstruct_LAOGLinks_100 {   2926 struct __anonstruct_LAOGLinks_100 {
2927    WordSetID inns ;   2927    WordSetID inns ;
2928    WordSetID outs ;   2928    WordSetID outs ;
2929 };   2929 };
2930 typedef struct __anonstruct_LAOGLinks_100 LAOGLinks;   2930 typedef struct __anonstruct_LAOGLinks_100 LAOGLinks;
2931 struct __anonstruct_LAOGLinkExposition_101 {   2931 struct __anonstruct_LAOGLinkExposition_101 {
2932    Addr src_ga ;   2932    Addr src_ga ;
2933    Addr dst_ga ;   2933    Addr dst_ga ;
2934    ExeContext *src_ec ;   2934    ExeContext *src_ec ;
2935    ExeContext *dst_ec ;   2935    ExeContext *dst_ec ;
2936 };   2936 };
2937 typedef struct __anonstruct_LAOGLinkExposition_101 LAOGLinkExposition;   2937 typedef struct __anonstruct_LAOGLinkExposition_101 LAOGLinkExposition;
2938 struct __anonstruct_MallocMeta_102 {   2938 struct __anonstruct_MallocMeta_102 {
2939    void *next ;   2939    void *next ;
2940    Addr payload ;   2940    Addr payload ;
2941    SizeT szB ;   2941    SizeT szB ;
2942    ExeContext *where ;   2942    ExeContext *where ;
2943    Thread *thr ;   2943    Thread *thr ;
2944 };   2944 };
2945 typedef struct __anonstruct_MallocMeta_102 MallocMeta;   2945 typedef struct __anonstruct_MallocMeta_102 MallocMeta;
2946 struct _MallocMeta;   2946 struct _MallocMeta;
2947 __inline static Bool toBool(Int x )   2947 __inline static Bool toBool(Int x )
2948 {   2948 {
2949   Int r ;   2949   Int r ;
2950   int tmp ;   2950   int tmp ;
2951     2951  
2952   {   2952   {
2953   if (x == 0) {   2953   if (x == 0) {
2954     tmp = (int )((Bool )0);   2954     tmp = (int )((Bool )0);
2955   } else {   2955   } else {
2956     tmp = (int )((Bool )1);   2956     tmp = (int )((Bool )1);
2957   }   2957   }
2958   r = tmp;   2958   r = tmp;
2959   return ((Bool )r);   2959   return ((Bool )r);
2960 }   2960 }
2961 }   2961 }
2962 __inline static UChar toUChar(Int x )   2962 __inline static UChar toUChar(Int x )
2963 {   2963 {
2964     2964  
2965     2965  
2966   {   2966   {
2967   x &= 255;   2967   x &= 255;
2968   return ((UChar )x);   2968   return ((UChar )x);
2969 }   2969 }
2970 }   2970 }
2971 __inline static HChar toHChar(Int x )   2971 __inline static HChar toHChar(Int x )
2972 {   2972 {
2973     2973  
2974     2974  
2975   {   2975   {
2976   x &= 255;   2976   x &= 255;
2977   return ((HChar )x);   2977   return ((HChar )x);
2978 }   2978 }
2979 }   2979 }
2980 __inline static UShort toUShort(Int x )   2980 __inline static UShort toUShort(Int x )
2981 {   2981 {
2982     2982  
2983     2983  
2984   {   2984   {
2985   x &= 65535;   2985   x &= 65535;
2986   return ((UShort )x);   2986   return ((UShort )x);
2987 }   2987 }
2988 }   2988 }
2989 __inline static Short toShort(Int x )   2989 __inline static Short toShort(Int x )
2990 {   2990 {
2991     2991  
2992     2992  
2993   {   2993   {
2994   x &= 65535;   2994   x &= 65535;
2995   return ((Short )x);   2995   return ((Short )x);
2996 }   2996 }
2997 }   2997 }
2998 __inline static UInt toUInt(Long x )   2998 __inline static UInt toUInt(Long x )
2999 {   2999 {
3000     3000  
3001     3001  
3002   {   3002   {
3003   x &= 4294967295LL;   3003   x &= 4294967295LL;
3004   return ((UInt )x);   3004   return ((UInt )x);
3005 }   3005 }
3006 }   3006 }
3007 __inline static ULong Ptr_to_ULong(void *p )   3007 __inline static ULong Ptr_to_ULong(void *p )
3008 {   3008 {
3009   UInt w ;   3009   UInt w ;
3010     3010  
3011   {   3011   {
3012   w = (UInt )p;   3012   w = (UInt )p;
3013   return ((ULong )w);   3013   return ((ULong )w);
3014 }   3014 }
3015 }   3015 }
3016 __inline static void *ULong_to_Ptr(ULong n )   3016 __inline static void *ULong_to_Ptr(ULong n )
3017 {   3017 {
3018   UInt w ;   3018   UInt w ;
3019     3019  
3020   {   3020   {
3021   w = (UInt )n;   3021   w = (UInt )n;
3022   return ((void *)w);   3022   return ((void *)w);
3023 }   3023 }
3024 }   3024 }
3025 __inline static Bool sr_isError(SysRes sr )   3025 __inline static Bool sr_isError(SysRes sr )
3026 {   3026 {
3027     3027  
3028     3028  
3029   {   3029   {
3030   return (sr._isError);   3030   return (sr._isError);
3031 }   3031 }
3032 }   3032 }
3033 __inline static UWord sr_Res(SysRes sr )   3033 __inline static UWord sr_Res(SysRes sr )
3034 {   3034 {
3035   UWord tmp ;   3035   UWord tmp ;
3036     3036  
3037   {   3037   {
3038   if (sr._isError) {   3038   if (sr._isError) {
3039     tmp = (UWord )0;   3039     tmp = (UWord )0;
3040   } else {   3040   } else {
3041     tmp = sr._val;   3041     tmp = sr._val;
3042   }   3042   }
3043   return (tmp);   3043   return (tmp);
3044 }   3044 }
3045 }   3045 }
3046 __inline static UWord sr_ResHI(SysRes sr )   3046 __inline static UWord sr_ResHI(SysRes sr )
3047 {   3047 {
3048     3048  
3049     3049  
3050   {   3050   {
3051   return ((UWord )0);   3051   return ((UWord )0);
3052 }   3052 }
3053 }   3053 }
3054 __inline static UWord sr_Err(SysRes sr )   3054 __inline static UWord sr_Err(SysRes sr )
3055 {   3055 {
3056   UWord tmp ;   3056   UWord tmp ;
3057     3057  
3058   {   3058   {
3059   if (sr._isError) {   3059   if (sr._isError) {
3060     tmp = sr._val;   3060     tmp = sr._val;
3061   } else {   3061   } else {
3062     tmp = (UWord )0;   3062     tmp = (UWord )0;
3063   }   3063   }
3064   return (tmp);   3064   return (tmp);
3065 }   3065 }
3066 }   3066 }
3067 __inline static Bool sr_EQ(SysRes sr1 , SysRes sr2 )   3067 __inline static Bool sr_EQ(SysRes sr1 , SysRes sr2 )
3068 {   3068 {
3069   int tmp ;   3069   int tmp ;
3070     3070  
3071   {   3071   {
3072   if (sr1._val == sr2._val) {   3072   if (sr1._val == sr2._val) {
3073     if (sr1._isError) {   3073     if (sr1._isError) {
3074       if (sr2._isError) {   3074       if (sr2._isError) {
3075         tmp = 1;   3075         tmp = 1;
3076       } else {   3076       } else {
3077         goto _L;   3077         goto _L;
3078       }   3078       }
3079     } else   3079     } else
3080     _L: /* CIL Label */   3080     _L: /* CIL Label */
3081     if (! sr1._isError) {   3081     if (! sr1._isError) {
3082       if (! sr2._isError) {   3082       if (! sr2._isError) {
3083         tmp = 1;   3083         tmp = 1;
3084       } else {   3084       } else {
3085         tmp = 0;   3085         tmp = 0;
3086       }   3086       }
3087     } else {   3087     } else {
3088       tmp = 0;   3088       tmp = 0;
3089     }   3089     }
3090   } else {   3090   } else {
3091     tmp = 0;   3091     tmp = 0;
3092   }   3092   }
3093   return ((Bool )tmp);   3093   return ((Bool )tmp);
3094 }   3094 }
3095 }   3095 }
3096 extern  __attribute__((__noreturn__)) void vgPlain_exit(Int status ) ;   3096 extern  __attribute__((__noreturn__)) void vgPlain_exit(Int status ) ;
3097 extern  __attribute__((__noreturn__)) void vgPlain_tool_panic(Char *str ) ;   3097 extern  __attribute__((__noreturn__)) void vgPlain_tool_panic(Char *str ) ;
3098 extern  __attribute__((__noreturn__)) void vgPlain_assert_fail(Bool isCore ,   3098 extern  __attribute__((__noreturn__)) void vgPlain_assert_fail(Bool isCore ,
3099                                                                Char const   *expr ,   3099                                                                Char const   *expr ,
3100                                                                Char const   *file ,   3100                                                                Char const   *file ,
3101                                                                Int line ,   3101                                                                Int line ,
3102                                                                Char const   *fn ,   3102                                                                Char const   *fn ,
3103                                                                HChar const   *format   3103                                                                HChar const   *format
3104                                                                , ...) ;   3104                                                                , ...) ;
3105 extern Bool vgPlain_isspace(Char c ) ;   3105 extern Bool vgPlain_isspace(Char c ) ;
3106 extern Bool vgPlain_isdigit(Char c ) ;   3106 extern Bool vgPlain_isdigit(Char c ) ;
3107 extern Char vgPlain_tolower(Char c ) ;   3107 extern Char vgPlain_tolower(Char c ) ;
3108 extern Long vgPlain_strtoll10(Char *str , Char **endptr ) ;   3108 extern Long vgPlain_strtoll10(Char *str , Char **endptr ) ;
3109 extern Long vgPlain_strtoll16(Char *str , Char **endptr ) ;   3109 extern Long vgPlain_strtoll16(Char *str , Char **endptr ) ;
3110 extern double vgPlain_strtod(Char *str , Char **endptr ) ;   3110 extern double vgPlain_strtod(Char *str , Char **endptr ) ;
3111 extern SizeT vgPlain_strlen(Char const   *str ) ;   3111 extern SizeT vgPlain_strlen(Char const   *str ) ;
3112 extern Char *vgPlain_strcat(Char *dest , Char const   *src ) ;   3112 extern Char *vgPlain_strcat(Char *dest , Char const   *src ) ;
3113 extern Char *vgPlain_strncat(Char *dest , Char const   *src , SizeT n ) ;   3113 extern Char *vgPlain_strncat(Char *dest , Char const   *src , SizeT n ) ;
3114 extern Char *vgPlain_strpbrk(Char const   *s , Char const   *accpt ) ;   3114 extern Char *vgPlain_strpbrk(Char const   *s , Char const   *accpt ) ;
3115 extern Char *vgPlain_strcpy(Char *dest , Char const   *src ) ;   3115 extern Char *vgPlain_strcpy(Char *dest , Char const   *src ) ;
3116 extern Char *vgPlain_strncpy(Char *dest , Char const   *src , SizeT ndest ) ;   3116 extern Char *vgPlain_strncpy(Char *dest , Char const   *src , SizeT ndest ) ;
3117 extern Int vgPlain_strcmp(Char const   *s1 , Char const   *s2 ) ;   3117 extern Int vgPlain_strcmp(Char const   *s1 , Char const   *s2 ) ;
3118 extern Int vgPlain_strcasecmp(Char const   *s1 , Char const   *s2 ) ;   3118 extern Int vgPlain_strcasecmp(Char const   *s1 , Char const   *s2 ) ;
3119 extern Int vgPlain_strncmp(Char const   *s1 , Char const   *s2 , SizeT nmax ) ;   3119 extern Int vgPlain_strncmp(Char const   *s1 , Char const   *s2 , SizeT nmax ) ;
3120 extern Int vgPlain_strncasecmp(Char const   *s1 , Char const   *s2 , SizeT nmax ) ;   3120 extern Int vgPlain_strncasecmp(Char const   *s1 , Char const   *s2 , SizeT nmax ) ;
3121 extern Char *vgPlain_strstr(Char const   *haystack , Char *needle ) ;   3121 extern Char *vgPlain_strstr(Char const   *haystack , Char *needle ) ;
3122 extern Char *vgPlain_strcasestr(Char const   *haystack , Char *needle ) ;   3122 extern Char *vgPlain_strcasestr(Char const   *haystack , Char *needle ) ;
3123 extern Char *vgPlain_strchr(Char const   *s , Char c ) ;   3123 extern Char *vgPlain_strchr(Char const   *s , Char c ) ;
3124 extern Char *vgPlain_strrchr(Char const   *s , Char c ) ;   3124 extern Char *vgPlain_strrchr(Char const   *s , Char c ) ;
3125 extern SizeT vgPlain_strspn(Char const   *s , Char const   *accpt ) ;   3125 extern SizeT vgPlain_strspn(Char const   *s , Char const   *accpt ) ;
3126 extern SizeT vgPlain_strcspn(Char const   *s , char const   *reject ) ;   3126 extern SizeT vgPlain_strcspn(Char const   *s , char const   *reject ) ;
3127 extern void vgPlain_strncpy_safely(Char *dest , Char const   *src , SizeT ndest ) ;   3127 extern void vgPlain_strncpy_safely(Char *dest , Char const   *src , SizeT ndest ) ;
3128 extern void *vgPlain_memcpy(void *d , void const   *s , SizeT sz ) ;   3128 extern void *vgPlain_memcpy(void *d , void const   *s , SizeT sz ) ;
3129 extern void *vgPlain_memmove(void *d , void const   *s , SizeT sz ) ;   3129 extern void *vgPlain_memmove(void *d , void const   *s , SizeT sz ) ;
3130 extern void *vgPlain_memset(void *s , Int c , SizeT sz ) ;   3130 extern void *vgPlain_memset(void *s , Int c , SizeT sz ) ;
3131 extern Int vgPlain_memcmp(void const   *s1 , void const   *s2 , SizeT n ) ;   3131 extern Int vgPlain_memcmp(void const   *s1 , void const   *s2 , SizeT n ) ;
3132 __inline static void ( __attribute__((__always_inline__)) vgPlain_bzero_inline)(void *s ,   3132 __inline static void ( __attribute__((__always_inline__)) vgPlain_bzero_inline)(void *s ,
3133                                                                                 SizeT sz )   3133                                                                                 SizeT sz )
3134 {   3134 {
3135   UWord *p ;   3135   UWord *p ;
3136   UWord tmp ;   3136   UWord tmp ;
3137   UWord tmp___0 ;   3137   UWord tmp___0 ;
3138   UWord tmp___1 ;   3138   UWord tmp___1 ;
3139   UWord tmp___2 ;   3139   UWord tmp___2 ;
3140   UWord tmp___3 ;   3140   UWord tmp___3 ;
3141   UWord tmp___4 ;   3141   UWord tmp___4 ;
3142   UWord tmp___5 ;   3142   UWord tmp___5 ;
3143   UWord tmp___6 ;   3143   UWord tmp___6 ;
3144   UWord tmp___7 ;   3144   UWord tmp___7 ;
3145   UWord tmp___8 ;   3145   UWord tmp___8 ;
3146   UWord tmp___9 ;   3146   UWord tmp___9 ;
3147   UWord tmp___10 ;   3147   UWord tmp___10 ;
3148   UWord tmp___11 ;   3148   UWord tmp___11 ;
3149   UWord tmp___12 ;   3149   UWord tmp___12 ;
3150   UWord tmp___13 ;   3150   UWord tmp___13 ;
3151   UWord tmp___14 ;   3151   UWord tmp___14 ;
3152   UWord tmp___15 ;   3152   UWord tmp___15 ;
3153   UWord tmp___16 ;   3153   UWord tmp___16 ;
3154   UWord tmp___17 ;   3154   UWord tmp___17 ;
3155   UWord tmp___18 ;   3155   UWord tmp___18 ;
3156   UWord tmp___19 ;   3156   UWord tmp___19 ;
3157   UWord tmp___20 ;   3157   UWord tmp___20 ;
3158   UWord tmp___21 ;   3158   UWord tmp___21 ;
3159   UWord tmp___22 ;   3159   UWord tmp___22 ;
3160   UWord tmp___23 ;   3160   UWord tmp___23 ;
3161   UWord tmp___24 ;   3161   UWord tmp___24 ;
3162   UWord tmp___25 ;   3162   UWord tmp___25 ;
3163   UWord tmp___26 ;   3163   UWord tmp___26 ;
3164   long tmp___27 ;   3164   long tmp___27 ;
3165   long tmp___28 ;   3165   long tmp___28 ;
3166     3166  
3167   {   3167   {
3168   tmp___27 = __builtin_expect((long )(! (! (0UL == (sz & (Addr )(sizeof(UWord ) - 1U))))),   3168   tmp___27 = __builtin_expect((long )(! (! (0UL == (sz & (Addr )(sizeof(UWord ) - 1U))))),
3169                               1L);   3169                               1L);
3170   if (tmp___27) {   3170   if (tmp___27) {
3171     tmp___28 = __builtin_expect((long )(! (! (0UL == ((Addr )s & (Addr )(sizeof(UWord ) - 1U))))),   3171     tmp___28 = __builtin_expect((long )(! (! (0UL == ((Addr )s & (Addr )(sizeof(UWord ) - 1U))))),
3172                                 1L);   3172                                 1L);
3173     if (tmp___28) {   3173     if (tmp___28) {
3174       p = (UWord *)s;   3174       p = (UWord *)s;
3175       switch (sz / (SizeT )sizeof(UWord )) {   3175       switch (sz / (SizeT )sizeof(UWord )) {
3176       case 8UL:   3176       case 8UL:
3177       tmp___5 = 0UL;   3177       tmp___5 = 0UL;
3178       *(p + 7) = tmp___5;   3178       *(p + 7) = tmp___5;
3179       tmp___4 = tmp___5;   3179       tmp___4 = tmp___5;
3180       *(p + 6) = tmp___4;   3180       *(p + 6) = tmp___4;
3181       tmp___3 = tmp___4;   3181       tmp___3 = tmp___4;
3182       *(p + 5) = tmp___3;   3182       *(p + 5) = tmp___3;
3183       tmp___2 = tmp___3;   3183       tmp___2 = tmp___3;
3184       *(p + 4) = tmp___2;   3184       *(p + 4) = tmp___2;
3185       tmp___1 = tmp___2;   3185       tmp___1 = tmp___2;
3186       *(p + 3) = tmp___1;   3186       *(p + 3) = tmp___1;
3187       tmp___0 = tmp___1;   3187       tmp___0 = tmp___1;
3188       *(p + 2) = tmp___0;   3188       *(p + 2) = tmp___0;
3189       tmp = tmp___0;   3189       tmp = tmp___0;
3190       *(p + 1) = tmp;   3190       *(p + 1) = tmp;
3191       *(p + 0) = tmp;   3191       *(p + 0) = tmp;
3192       return;   3192       return;
3193       case 7UL:   3193       case 7UL:
3194       tmp___11 = 0UL;   3194       tmp___11 = 0UL;
3195       *(p + 6) = tmp___11;   3195       *(p + 6) = tmp___11;
3196       tmp___10 = tmp___11;   3196       tmp___10 = tmp___11;
3197       *(p + 5) = tmp___10;   3197       *(p + 5) = tmp___10;
3198       tmp___9 = tmp___10;   3198       tmp___9 = tmp___10;
3199       *(p + 4) = tmp___9;   3199       *(p + 4) = tmp___9;
3200       tmp___8 = tmp___9;   3200       tmp___8 = tmp___9;
3201       *(p + 3) = tmp___8;   3201       *(p + 3) = tmp___8;
3202       tmp___7 = tmp___8;   3202       tmp___7 = tmp___8;
3203       *(p + 2) = tmp___7;   3203       *(p + 2) = tmp___7;
3204       tmp___6 = tmp___7;   3204       tmp___6 = tmp___7;
3205       *(p + 1) = tmp___6;   3205       *(p + 1) = tmp___6;
3206       *(p + 0) = tmp___6;   3206       *(p + 0) = tmp___6;
3207       return;   3207       return;
3208       case 6UL:   3208       case 6UL:
3209       tmp___16 = 0UL;   3209       tmp___16 = 0UL;
3210       *(p + 5) = tmp___16;   3210       *(p + 5) = tmp___16;
3211       tmp___15 = tmp___16;   3211       tmp___15 = tmp___16;
3212       *(p + 4) = tmp___15;   3212       *(p + 4) = tmp___15;
3213       tmp___14 = tmp___15;   3213       tmp___14 = tmp___15;
3214       *(p + 3) = tmp___14;   3214       *(p + 3) = tmp___14;
3215       tmp___13 = tmp___14;   3215       tmp___13 = tmp___14;
3216       *(p + 2) = tmp___13;   3216       *(p + 2) = tmp___13;
3217       tmp___12 = tmp___13;   3217       tmp___12 = tmp___13;
3218       *(p + 1) = tmp___12;   3218       *(p + 1) = tmp___12;
3219       *(p + 0) = tmp___12;   3219       *(p + 0) = tmp___12;
3220       return;   3220       return;
3221       case 5UL:   3221       case 5UL:
3222       tmp___20 = 0UL;   3222       tmp___20 = 0UL;
3223       *(p + 4) = tmp___20;   3223       *(p + 4) = tmp___20;
3224       tmp___19 = tmp___20;   3224       tmp___19 = tmp___20;
3225       *(p + 3) = tmp___19;   3225       *(p + 3) = tmp___19;
3226       tmp___18 = tmp___19;   3226       tmp___18 = tmp___19;
3227       *(p + 2) = tmp___18;   3227       *(p + 2) = tmp___18;
3228       tmp___17 = tmp___18;   3228       tmp___17 = tmp___18;
3229       *(p + 1) = tmp___17;   3229       *(p + 1) = tmp___17;
3230       *(p + 0) = tmp___17;   3230       *(p + 0) = tmp___17;
3231       return;   3231       return;
3232       case 4UL:   3232       case 4UL:
3233       tmp___23 = 0UL;   3233       tmp___23 = 0UL;
3234       *(p + 3) = tmp___23;   3234       *(p + 3) = tmp___23;
3235       tmp___22 = tmp___23;   3235       tmp___22 = tmp___23;
3236       *(p + 2) = tmp___22;   3236       *(p + 2) = tmp___22;
3237       tmp___21 = tmp___22;   3237       tmp___21 = tmp___22;
3238       *(p + 1) = tmp___21;   3238       *(p + 1) = tmp___21;
3239       *(p + 0) = tmp___21;   3239       *(p + 0) = tmp___21;
3240       return;   3240       return;
3241       case 3UL:   3241       case 3UL:
3242       tmp___25 = 0UL;   3242       tmp___25 = 0UL;
3243       *(p + 2) = tmp___25;   3243       *(p + 2) = tmp___25;
3244       tmp___24 = tmp___25;   3244       tmp___24 = tmp___25;
3245       *(p + 1) = tmp___24;   3245       *(p + 1) = tmp___24;
3246       *(p + 0) = tmp___24;   3246       *(p + 0) = tmp___24;
3247       return;   3247       return;
3248       case 2UL:   3248       case 2UL:
3249       tmp___26 = 0UL;   3249       tmp___26 = 0UL;
3250       *(p + 1) = tmp___26;   3250       *(p + 1) = tmp___26;
3251       *(p + 0) = tmp___26;   3251       *(p + 0) = tmp___26;
3252       return;   3252       return;
3253       case 1UL:   3253       case 1UL:
3254       *(p + 0) = 0UL;   3254       *(p + 0) = 0UL;
3255       return;   3255       return;
3256       case 0UL:   3256       case 0UL:
3257       return;   3257       return;
3258       default:   3258       default:
3259       break;   3259       break;
3260       }   3260       }
3261     } else {   3261     } else {
3262     3262  
3263     }   3263     }
3264   } else {   3264   } else {
3265     3265  
3266   }   3266   }
3267   vgPlain_memset(s, 0, sz);   3267   vgPlain_memset(s, 0, sz);
3268   return;   3268   return;
3269 }   3269 }
3270 }   3270 }
3271 extern void vgPlain_ssort(void *base , SizeT nmemb , SizeT size ,   3271 extern void vgPlain_ssort(void *base , SizeT nmemb , SizeT size ,
3272                           Int (*compar)(void * , void * ) ) ;   3272                           Int (*compar)(void * , void * ) ) ;
3273 extern Int vgPlain_log2(UInt x ) ;   3273 extern Int vgPlain_log2(UInt x ) ;
3274 extern UInt vgPlain_random(UInt *pSeed ) ;   3274 extern UInt vgPlain_random(UInt *pSeed ) ;
3275 extern UInt ( /* format attribute */  vgPlain_sprintf)(Char *buf ,   3275 extern UInt ( /* format attribute */  vgPlain_sprintf)(Char *buf ,
3276                                                        HChar const   *format   3276                                                        HChar const   *format
3277                                                        , ...) ;   3277                                                        , ...) ;
3278 extern UInt ( /* format attribute */  vgPlain_vsprintf)(Char *buf ,   3278 extern UInt ( /* format attribute */  vgPlain_vsprintf)(Char *buf ,
3279                                                         HChar const   *format ,   3279                                                         HChar const   *format ,
3280                                                         va_list vargs ) ;   3280                                                         va_list vargs ) ;
3281 extern UInt ( /* format attribute */  vgPlain_snprintf)(Char *buf , Int size ,   3281 extern UInt ( /* format attribute */  vgPlain_snprintf)(Char *buf , Int size ,
3282                                                         HChar const   *format   3282                                                         HChar const   *format
3283                                                         , ...) ;   3283                                                         , ...) ;
3284 extern UInt ( /* format attribute */  vgPlain_vsnprintf)(Char *buf , Int size ,   3284 extern UInt ( /* format attribute */  vgPlain_vsnprintf)(Char *buf , Int size ,
3285                                                          HChar const   *format ,   3285                                                          HChar const   *format ,
3286                                                          va_list vargs ) ;   3286                                                          va_list vargs ) ;
3287 extern void vgPlain_percentify(ULong n , ULong m , UInt d , Int n_buf ,   3287 extern void vgPlain_percentify(ULong n , ULong m , UInt d , Int n_buf ,
3288                                char *buf ) ;   3288                                char *buf ) ;
3289 extern UInt ( /* format attribute */  vgPlain_printf)(HChar const   *format   3289 extern UInt ( /* format attribute */  vgPlain_printf)(HChar const   *format
3290                                                       , ...) ;   3290                                                       , ...) ;
3291 extern UInt ( /* format attribute */  vgPlain_vprintf)(HChar const   *format ,   3291 extern UInt ( /* format attribute */  vgPlain_vprintf)(HChar const   *format ,
3292                                                        va_list vargs ) ;   3292                                                        va_list vargs ) ;
3293 extern UInt ( /* format attribute */  vgPlain_printf_xml)(HChar const   *format   3293 extern UInt ( /* format attribute */  vgPlain_printf_xml)(HChar const   *format
3294                                                           , ...) ;   3294                                                           , ...) ;
3295 extern UInt ( /* format attribute */  vgPlain_vprintf_xml)(HChar const   *format ,   3295 extern UInt ( /* format attribute */  vgPlain_vprintf_xml)(HChar const   *format ,
3296                                                            va_list vargs ) ;   3296                                                            va_list vargs ) ;
3297 extern UInt vgPlain_printf_xml_no_f_c(HChar const   *format  , ...) ;   3297 extern UInt vgPlain_printf_xml_no_f_c(HChar const   *format  , ...) ;
3298 extern void vgPlain_vcbprintf(void (*char_sink)(HChar  , void *opaque ) ,   3298 extern void vgPlain_vcbprintf(void (*char_sink)(HChar  , void *opaque ) ,
3299                               void *opaque , HChar const   *format ,   3299                               void *opaque , HChar const   *format ,
3300                               va_list vargs ) ;   3300                               va_list vargs ) ;
3301 extern UInt vgPlain_message_no_f_c(VgMsgKind kind , HChar const   *format  , ...) ;   3301 extern UInt vgPlain_message_no_f_c(VgMsgKind kind , HChar const   *format  , ...) ;
3302 extern UInt ( /* format attribute */  vgPlain_message)(VgMsgKind kind ,   3302 extern UInt ( /* format attribute */  vgPlain_message)(VgMsgKind kind ,
3303                                                        HChar const   *format   3303                                                        HChar const   *format
3304                                                        , ...) ;   3304                                                        , ...) ;
3305 extern UInt ( /* format attribute */  vgPlain_vmessage)(VgMsgKind kind ,   3305 extern UInt ( /* format attribute */  vgPlain_vmessage)(VgMsgKind kind ,
3306                                                         HChar const   *format ,   3306                                                         HChar const   *format ,
3307                                                         va_list vargs ) ;   3307                                                         va_list vargs ) ;
3308 extern UInt ( /* format attribute */  vgPlain_fmsg)(HChar const   *format  , ...) ;   3308 extern UInt ( /* format attribute */  vgPlain_fmsg)(HChar const   *format  , ...) ;
3309 extern  __attribute__((__noreturn__)) void ( /* format attribute */  vgPlain_fmsg_bad_option)(HChar *opt ,   3309 extern  __attribute__((__noreturn__)) void ( /* format attribute */  vgPlain_fmsg_bad_option)(HChar *opt ,
3310                                                                                               HChar const   *format   3310                                                                                               HChar const   *format
3311                                                                                               , ...) ;   3311                                                                                               , ...) ;
3312 extern UInt ( /* format attribute */  vgPlain_umsg)(HChar const   *format  , ...) ;   3312 extern UInt ( /* format attribute */  vgPlain_umsg)(HChar const   *format  , ...) ;
3313 extern UInt ( /* format attribute */  vgPlain_dmsg)(HChar const   *format  , ...) ;   3313 extern UInt ( /* format attribute */  vgPlain_dmsg)(HChar const   *format  , ...) ;
3314 extern void vgPlain_message_flush(void) ;   3314 extern void vgPlain_message_flush(void) ;
3315 extern ThreadId vgPlain_get_running_tid(void) ;   3315 extern ThreadId vgPlain_get_running_tid(void) ;
3316 extern ExeContext *vgPlain_record_ExeContext(ThreadId tid , Word first_ip_delta ) ;   3316 extern ExeContext *vgPlain_record_ExeContext(ThreadId tid , Word first_ip_delta ) ;
3317 extern ExeContext *vgPlain_record_depth_1_ExeContext(ThreadId tid ) ;   3317 extern ExeContext *vgPlain_record_depth_1_ExeContext(ThreadId tid ) ;
3318 extern void vgPlain_apply_ExeContext(void (*action)(UInt n , Addr ip ) ,   3318 extern void vgPlain_apply_ExeContext(void (*action)(UInt n , Addr ip ) ,
3319                                      ExeContext *ec , UInt n_ips ) ;   3319                                      ExeContext *ec , UInt n_ips ) ;
3320 extern Bool vgPlain_eq_ExeContext(VgRes res , ExeContext *e1 , ExeContext *e2 ) ;   3320 extern Bool vgPlain_eq_ExeContext(VgRes res , ExeContext *e1 , ExeContext *e2 ) ;
3321 extern void vgPlain_pp_ExeContext(ExeContext *ec ) ;   3321 extern void vgPlain_pp_ExeContext(ExeContext *ec ) ;
3322 extern UInt vgPlain_get_ECU_from_ExeContext(ExeContext *e ) ;   3322 extern UInt vgPlain_get_ECU_from_ExeContext(ExeContext *e ) ;
3323 extern Int vgPlain_get_ExeContext_n_ips(ExeContext *e ) ;   3323 extern Int vgPlain_get_ExeContext_n_ips(ExeContext *e ) ;
3324 extern ExeContext *vgPlain_get_ExeContext_from_ECU(UInt uniq ) ;   3324 extern ExeContext *vgPlain_get_ExeContext_from_ECU(UInt uniq ) ;
3325 extern ExeContext *vgPlain_make_depth_1_ExeContext_from_Addr(Addr a ) ;   3325 extern ExeContext *vgPlain_make_depth_1_ExeContext_from_Addr(Addr a ) ;
3326 __inline static Bool vgPlain_is_plausible_ECU(UInt ecu )   3326 __inline static Bool vgPlain_is_plausible_ECU(UInt ecu )
3327 {   3327 {
3328   int tmp ;   3328   int tmp ;
3329     3329  
3330   {   3330   {
3331   if (ecu > 0U) {   3331   if (ecu > 0U) {
3332     if ((ecu & 3U) == 0U) {   3332     if ((ecu & 3U) == 0U) {
3333       tmp = 1;   3333       tmp = 1;
3334     } else {   3334     } else {
3335       tmp = 0;   3335       tmp = 0;
3336     }   3336     }
3337   } else {   3337   } else {
3338     tmp = 0;   3338     tmp = 0;
3339   }   3339   }
3340   return ((Bool )tmp);   3340   return ((Bool )tmp);
3341 }   3341 }
3342 }   3342 }
3343 extern ExeContext *vgPlain_make_ExeContext_from_StackTrace(Addr *ips ,   3343 extern ExeContext *vgPlain_make_ExeContext_from_StackTrace(Addr *ips ,
3344                                                            UInt n_ips ) ;   3344                                                            UInt n_ips ) ;
3345 extern ExeContext *vgPlain_get_error_where(Error *err ) ;   3345 extern ExeContext *vgPlain_get_error_where(Error *err ) ;
3346 extern ErrorKind vgPlain_get_error_kind(Error *err ) ;   3346 extern ErrorKind vgPlain_get_error_kind(Error *err ) ;
3347 extern Addr vgPlain_get_error_address(Error *err ) ;   3347 extern Addr vgPlain_get_error_address(Error *err ) ;
3348 extern Char *vgPlain_get_error_string(Error *err ) ;   3348 extern Char *vgPlain_get_error_string(Error *err ) ;
3349 extern void *vgPlain_get_error_extra(Error *err ) ;   3349 extern void *vgPlain_get_error_extra(Error *err ) ;
3350 extern void vgPlain_maybe_record_error(ThreadId tid , ErrorKind ekind , Addr a ,   3350 extern void vgPlain_maybe_record_error(ThreadId tid , ErrorKind ekind , Addr a ,
3351                                        Char *s , void *extra ) ;   3351                                        Char *s , void *extra ) ;
3352 extern Bool vgPlain_unique_error(ThreadId tid , ErrorKind ekind , Addr a ,   3352 extern Bool vgPlain_unique_error(ThreadId tid , ErrorKind ekind , Addr a ,
3353                                  Char *s , void *extra , ExeContext *where ,   3353                                  Char *s , void *extra , ExeContext *where ,
3354                                  Bool print_error , Bool allow_GDB_attach ,   3354                                  Bool print_error , Bool allow_GDB_attach ,
3355                                  Bool count_error ) ;   3355                                  Bool count_error ) ;
3356 extern Bool vgPlain_get_line(Int fd , Char **bufpp , SizeT *nBufp , Int *lineno ) ;   3356 extern Bool vgPlain_get_line(Int fd , Char **bufpp , SizeT *nBufp , Int *lineno ) ;
3357 extern SuppKind vgPlain_get_supp_kind(Supp *su ) ;   3357 extern SuppKind vgPlain_get_supp_kind(Supp *su ) ;
3358 extern Char *vgPlain_get_supp_string(Supp *su ) ;   3358 extern Char *vgPlain_get_supp_string(Supp *su ) ;
3359 extern void *vgPlain_get_supp_extra(Supp *su ) ;   3359 extern void *vgPlain_get_supp_extra(Supp *su ) ;
3360 extern void vgPlain_set_supp_kind(Supp *su , SuppKind suppkind ) ;   3360 extern void vgPlain_set_supp_kind(Supp *su , SuppKind suppkind ) ;
3361 extern void vgPlain_set_supp_string(Supp *su , Char *string ) ;   3361 extern void vgPlain_set_supp_string(Supp *su , Char *string ) ;
3362 extern void vgPlain_set_supp_extra(Supp *su , void *extra ) ;   3362 extern void vgPlain_set_supp_extra(Supp *su , void *extra ) ;
3363 extern void ppIRType(IRType  ) ;   3363 extern void ppIRType(IRType  ) ;
3364 extern Int sizeofIRType(IRType  ) ;   3364 extern Int sizeofIRType(IRType  ) ;
3365 extern IRConst *IRConst_U1(Bool  ) ;   3365 extern IRConst *IRConst_U1(Bool  ) ;
3366 extern IRConst *IRConst_U8(UChar  ) ;   3366 extern IRConst *IRConst_U8(UChar  ) ;
3367 extern IRConst *IRConst_U16(UShort  ) ;   3367 extern IRConst *IRConst_U16(UShort  ) ;
3368 extern IRConst *IRConst_U32(UInt  ) ;   3368 extern IRConst *IRConst_U32(UInt  ) ;
3369 extern IRConst *IRConst_U64(ULong  ) ;   3369 extern IRConst *IRConst_U64(ULong  ) ;
3370 extern IRConst *IRConst_F32(Float  ) ;   3370 extern IRConst *IRConst_F32(Float  ) ;
3371 extern IRConst *IRConst_F32i(UInt  ) ;   3371 extern IRConst *IRConst_F32i(UInt  ) ;
3372 extern IRConst *IRConst_F64(Double  ) ;   3372 extern IRConst *IRConst_F64(Double  ) ;
3373 extern IRConst *IRConst_F64i(ULong  ) ;   3373 extern IRConst *IRConst_F64i(ULong  ) ;
3374 extern IRConst *IRConst_V128(UShort  ) ;   3374 extern IRConst *IRConst_V128(UShort  ) ;
3375 extern IRConst *deepCopyIRConst(IRConst * ) ;   3375 extern IRConst *deepCopyIRConst(IRConst * ) ;
3376 extern void ppIRConst(IRConst * ) ;   3376 extern void ppIRConst(IRConst * ) ;
3377 extern Bool eqIRConst(IRConst * , IRConst * ) ;   3377 extern Bool eqIRConst(IRConst * , IRConst * ) ;
3378 extern IRCallee *mkIRCallee(Int regparms , HChar *name , void *addr ) ;   3378 extern IRCallee *mkIRCallee(Int regparms , HChar *name , void *addr ) ;
3379 extern IRCallee *deepCopyIRCallee(IRCallee * ) ;   3379 extern IRCallee *deepCopyIRCallee(IRCallee * ) ;
3380 extern void ppIRCallee(IRCallee * ) ;   3380 extern void ppIRCallee(IRCallee * ) ;
3381 extern IRRegArray *mkIRRegArray(Int  , IRType  , Int  ) ;   3381 extern IRRegArray *mkIRRegArray(Int  , IRType  , Int  ) ;
3382 extern IRRegArray *deepCopyIRRegArray(IRRegArray * ) ;   3382 extern IRRegArray *deepCopyIRRegArray(IRRegArray * ) ;
3383 extern void ppIRRegArray(IRRegArray * ) ;   3383 extern void ppIRRegArray(IRRegArray * ) ;
3384 extern Bool eqIRRegArray(IRRegArray * , IRRegArray * ) ;   3384 extern Bool eqIRRegArray(IRRegArray * , IRRegArray * ) ;
3385 extern void ppIRTemp(IRTemp  ) ;   3385 extern void ppIRTemp(IRTemp  ) ;
3386 extern void ppIROp(IROp  ) ;   3386 extern void ppIROp(IROp  ) ;
3387 extern IRExpr *IRExpr_Binder(Int binder ) ;   3387 extern IRExpr *IRExpr_Binder(Int binder ) ;
3388 extern IRExpr *IRExpr_Get(Int off , IRType ty ) ;   3388 extern IRExpr *IRExpr_Get(Int off , IRType ty ) ;
3389 extern IRExpr *IRExpr_GetI(IRRegArray *descr , IRExpr *ix , Int bias ) ;   3389 extern IRExpr *IRExpr_GetI(IRRegArray *descr , IRExpr *ix , Int bias ) ;
3390 extern IRExpr *IRExpr_RdTmp(IRTemp tmp ) ;   3390 extern IRExpr *IRExpr_RdTmp(IRTemp tmp ) ;
3391 extern IRExpr *IRExpr_Qop(IROp op , IRExpr *arg1 , IRExpr *arg2 , IRExpr *arg3 ,   3391 extern IRExpr *IRExpr_Qop(IROp op , IRExpr *arg1 , IRExpr *arg2 , IRExpr *arg3 ,
3392                           IRExpr *arg4 ) ;   3392                           IRExpr *arg4 ) ;
3393 extern IRExpr *IRExpr_Triop(IROp op , IRExpr *arg1 , IRExpr *arg2 ,   3393 extern IRExpr *IRExpr_Triop(IROp op , IRExpr *arg1 , IRExpr *arg2 ,
3394                             IRExpr *arg3 ) ;   3394                             IRExpr *arg3 ) ;
3395 extern IRExpr *IRExpr_Binop(IROp op , IRExpr *arg1 , IRExpr *arg2 ) ;   3395 extern IRExpr *IRExpr_Binop(IROp op , IRExpr *arg1 , IRExpr *arg2 ) ;
3396 extern IRExpr *IRExpr_Unop(IROp op , IRExpr *arg ) ;   3396 extern IRExpr *IRExpr_Unop(IROp op , IRExpr *arg ) ;
3397 extern IRExpr *IRExpr_Load(IREndness end , IRType ty , IRExpr *addr ) ;   3397 extern IRExpr *IRExpr_Load(IREndness end , IRType ty , IRExpr *addr ) ;
3398 extern IRExpr *IRExpr_Const(IRConst *con ) ;   3398 extern IRExpr *IRExpr_Const(IRConst *con ) ;
3399 extern IRExpr *IRExpr_CCall(IRCallee *cee , IRType retty , IRExpr **args ) ;   3399 extern IRExpr *IRExpr_CCall(IRCallee *cee , IRType retty , IRExpr **args ) ;
3400 extern IRExpr *IRExpr_Mux0X(IRExpr *cond , IRExpr *expr0 , IRExpr *exprX ) ;   3400 extern IRExpr *IRExpr_Mux0X(IRExpr *cond , IRExpr *expr0 , IRExpr *exprX ) ;
3401 extern IRExpr *deepCopyIRExpr(IRExpr * ) ;   3401 extern IRExpr *deepCopyIRExpr(IRExpr * ) ;
3402 extern void ppIRExpr(IRExpr * ) ;   3402 extern void ppIRExpr(IRExpr * ) ;
3403 extern IRExpr **mkIRExprVec_0(void) ;   3403 extern IRExpr **mkIRExprVec_0(void) ;
3404 extern IRExpr **mkIRExprVec_1(IRExpr * ) ;   3404 extern IRExpr **mkIRExprVec_1(IRExpr * ) ;
3405 extern IRExpr **mkIRExprVec_2(IRExpr * , IRExpr * ) ;   3405 extern IRExpr **mkIRExprVec_2(IRExpr * , IRExpr * ) ;
3406 extern IRExpr **mkIRExprVec_3(IRExpr * , IRExpr * , IRExpr * ) ;   3406 extern IRExpr **mkIRExprVec_3(IRExpr * , IRExpr * , IRExpr * ) ;
3407 extern IRExpr **mkIRExprVec_4(IRExpr * , IRExpr * , IRExpr * , IRExpr * ) ;   3407 extern IRExpr **mkIRExprVec_4(IRExpr * , IRExpr * , IRExpr * , IRExpr * ) ;
3408 extern IRExpr **mkIRExprVec_5(IRExpr * , IRExpr * , IRExpr * , IRExpr * ,   3408 extern IRExpr **mkIRExprVec_5(IRExpr * , IRExpr * , IRExpr * , IRExpr * ,
3409                               IRExpr * ) ;   3409                               IRExpr * ) ;
3410 extern IRExpr **mkIRExprVec_6(IRExpr * , IRExpr * , IRExpr * , IRExpr * ,   3410 extern IRExpr **mkIRExprVec_6(IRExpr * , IRExpr * , IRExpr * , IRExpr * ,
3411                               IRExpr * , IRExpr * ) ;   3411                               IRExpr * , IRExpr * ) ;
3412 extern IRExpr **mkIRExprVec_7(IRExpr * , IRExpr * , IRExpr * , IRExpr * ,   3412 extern IRExpr **mkIRExprVec_7(IRExpr * , IRExpr * , IRExpr * , IRExpr * ,
3413                               IRExpr * , IRExpr * , IRExpr * ) ;   3413                               IRExpr * , IRExpr * , IRExpr * ) ;
3414 extern IRExpr **mkIRExprVec_8(IRExpr * , IRExpr * , IRExpr * , IRExpr * ,   3414 extern IRExpr **mkIRExprVec_8(IRExpr * , IRExpr * , IRExpr * , IRExpr * ,
3415                               IRExpr * , IRExpr * , IRExpr * , IRExpr * ) ;   3415                               IRExpr * , IRExpr * , IRExpr * , IRExpr * ) ;
3416 extern IRExpr **shallowCopyIRExprVec(IRExpr ** ) ;   3416 extern IRExpr **shallowCopyIRExprVec(IRExpr ** ) ;
3417 extern IRExpr **deepCopyIRExprVec(IRExpr ** ) ;   3417 extern IRExpr **deepCopyIRExprVec(IRExpr ** ) ;
3418 extern IRExpr *mkIRExpr_HWord(HWord  ) ;   3418 extern IRExpr *mkIRExpr_HWord(HWord  ) ;
3419 extern IRExpr *mkIRExprCCall(IRType retty , Int regparms , HChar *name ,   3419 extern IRExpr *mkIRExprCCall(IRType retty , Int regparms , HChar *name ,
3420                              void *addr , IRExpr **args ) ;   3420                              void *addr , IRExpr **args ) ;
3421 __inline static Bool isIRAtom(IRExpr *e )   3421 __inline static Bool isIRAtom(IRExpr *e )
3422 {   3422 {
3423   int tmp ;   3423   int tmp ;
3424   Bool tmp___0 ;   3424   Bool tmp___0 ;
3425     3425  
3426   {   3426   {
3427   if ((unsigned int )e->tag == 86019U) {   3427   if ((unsigned int )e->tag == 86019U) {
3428     tmp = 1;   3428     tmp = 1;
3429   } else   3429   } else
3430   if ((unsigned int )e->tag == 86025U) {   3430   if ((unsigned int )e->tag == 86025U) {
3431     tmp = 1;   3431     tmp = 1;
3432   } else {   3432   } else {
3433     tmp = 0;   3433     tmp = 0;
3434   }   3434   }
3435   tmp___0 = toBool(tmp);   3435   tmp___0 = toBool(tmp);
3436   return (tmp___0);   3436   return (tmp___0);
3437 }   3437 }
3438 }   3438 }
3439 extern Bool eqIRAtom(IRExpr * , IRExpr * ) ;   3439 extern Bool eqIRAtom(IRExpr * , IRExpr * ) ;
3440 extern void ppIRJumpKind(IRJumpKind  ) ;   3440 extern void ppIRJumpKind(IRJumpKind  ) ;
3441 extern void ppIREffect(IREffect  ) ;   3441 extern void ppIREffect(IREffect  ) ;
3442 extern void ppIRDirty(IRDirty * ) ;   3442 extern void ppIRDirty(IRDirty * ) ;
3443 extern IRDirty *emptyIRDirty(void) ;   3443 extern IRDirty *emptyIRDirty(void) ;
3444 extern IRDirty *deepCopyIRDirty(IRDirty * ) ;   3444 extern IRDirty *deepCopyIRDirty(IRDirty * ) ;
3445 extern IRDirty *unsafeIRDirty_0_N(Int regparms , HChar *name , void *addr ,   3445 extern IRDirty *unsafeIRDirty_0_N(Int regparms , HChar *name , void *addr ,
3446                                   IRExpr **args ) ;   3446                                   IRExpr **args ) ;
3447 extern IRDirty *unsafeIRDirty_1_N(IRTemp dst , Int regparms , HChar *name ,   3447 extern IRDirty *unsafeIRDirty_1_N(IRTemp dst , Int regparms , HChar *name ,
3448                                   void *addr , IRExpr **args ) ;   3448                                   void *addr , IRExpr **args ) ;
3449 extern void ppIRMBusEvent(IRMBusEvent  ) ;   3449 extern void ppIRMBusEvent(IRMBusEvent  ) ;
3450 extern void ppIRCAS(IRCAS *cas ) ;   3450 extern void ppIRCAS(IRCAS *cas ) ;
3451 extern IRCAS *mkIRCAS(IRTemp oldHi , IRTemp oldLo , IREndness end ,   3451 extern IRCAS *mkIRCAS(IRTemp oldHi , IRTemp oldLo , IREndness end ,
3452                       IRExpr *addr , IRExpr *expdHi , IRExpr *expdLo ,   3452                       IRExpr *addr , IRExpr *expdHi , IRExpr *expdLo ,
3453                       IRExpr *dataHi , IRExpr *dataLo ) ;   3453                       IRExpr *dataHi , IRExpr *dataLo ) ;
3454 extern IRCAS *deepCopyIRCAS(IRCAS * ) ;   3454 extern IRCAS *deepCopyIRCAS(IRCAS * ) ;
3455 extern IRStmt *IRStmt_NoOp(void) ;   3455 extern IRStmt *IRStmt_NoOp(void) ;
3456 extern IRStmt *IRStmt_IMark(Addr64 addr , Int len ) ;   3456 extern IRStmt *IRStmt_IMark(Addr64 addr , Int len ) ;
3457 extern IRStmt *IRStmt_AbiHint(IRExpr *base , Int len , IRExpr *nia ) ;   3457 extern IRStmt *IRStmt_AbiHint(IRExpr *base , Int len , IRExpr *nia ) ;
3458 extern IRStmt *IRStmt_Put(Int off , IRExpr *data ) ;   3458 extern IRStmt *IRStmt_Put(Int off , IRExpr *data ) ;
3459 extern IRStmt *IRStmt_PutI(IRRegArray *descr , IRExpr *ix , Int bias ,   3459 extern IRStmt *IRStmt_PutI(IRRegArray *descr , IRExpr *ix , Int bias ,
3460                            IRExpr *data ) ;   3460                            IRExpr *data ) ;
3461 extern IRStmt *IRStmt_WrTmp(IRTemp tmp , IRExpr *data ) ;   3461 extern IRStmt *IRStmt_WrTmp(IRTemp tmp , IRExpr *data ) ;
3462 extern IRStmt *IRStmt_Store(IREndness end , IRExpr *addr , IRExpr *data ) ;   3462 extern IRStmt *IRStmt_Store(IREndness end , IRExpr *addr , IRExpr *data ) ;
3463 extern IRStmt *IRStmt_CAS(IRCAS *details ) ;   3463 extern IRStmt *IRStmt_CAS(IRCAS *details ) ;
3464 extern IRStmt *IRStmt_LLSC(IREndness end , IRTemp result , IRExpr *addr ,   3464 extern IRStmt *IRStmt_LLSC(IREndness end , IRTemp result , IRExpr *addr ,
3465                            IRExpr *storedata ) ;   3465                            IRExpr *storedata ) ;
3466 extern IRStmt *IRStmt_Dirty(IRDirty *details ) ;   3466 extern IRStmt *IRStmt_Dirty(IRDirty *details ) ;
3467 extern IRStmt *IRStmt_MBE(IRMBusEvent event ) ;   3467 extern IRStmt *IRStmt_MBE(IRMBusEvent event ) ;
3468 extern IRStmt *IRStmt_Exit(IRExpr *guard , IRJumpKind jk , IRConst *dst ) ;   3468 extern IRStmt *IRStmt_Exit(IRExpr *guard , IRJumpKind jk , IRConst *dst ) ;
3469 extern IRStmt *deepCopyIRStmt(IRStmt * ) ;   3469 extern IRStmt *deepCopyIRStmt(IRStmt * ) ;
3470 extern void ppIRStmt(IRStmt * ) ;   3470 extern void ppIRStmt(IRStmt * ) ;
3471 extern IRTemp newIRTemp(IRTypeEnv * , IRType  ) ;   3471 extern IRTemp newIRTemp(IRTypeEnv * , IRType  ) ;
3472 extern IRTypeEnv *deepCopyIRTypeEnv(IRTypeEnv * ) ;   3472 extern IRTypeEnv *deepCopyIRTypeEnv(IRTypeEnv * ) ;
3473 extern void ppIRTypeEnv(IRTypeEnv * ) ;   3473 extern void ppIRTypeEnv(IRTypeEnv * ) ;
3474 extern IRSB *emptyIRSB(void) ;   3474 extern IRSB *emptyIRSB(void) ;
3475 extern IRSB *deepCopyIRSB(IRSB * ) ;   3475 extern IRSB *deepCopyIRSB(IRSB * ) ;
3476 extern IRSB *deepCopyIRSBExceptStmts(IRSB * ) ;   3476 extern IRSB *deepCopyIRSBExceptStmts(IRSB * ) ;
3477 extern void ppIRSB(IRSB * ) ;   3477 extern void ppIRSB(IRSB * ) ;
3478 extern void addStmtToIRSB(IRSB * , IRStmt * ) ;   3478 extern void addStmtToIRSB(IRSB * , IRStmt * ) ;
3479 extern IRTypeEnv *emptyIRTypeEnv(void) ;   3479 extern IRTypeEnv *emptyIRTypeEnv(void) ;
3480 extern IRType typeOfIRConst(IRConst * ) ;   3480 extern IRType typeOfIRConst(IRConst * ) ;
3481 extern IRType typeOfIRTemp(IRTypeEnv * , IRTemp  ) ;   3481 extern IRType typeOfIRTemp(IRTypeEnv * , IRTemp  ) ;
3482 extern IRType typeOfIRExpr(IRTypeEnv * , IRExpr * ) ;   3482 extern IRType typeOfIRExpr(IRTypeEnv * , IRExpr * ) ;
3483 extern void sanityCheckIRSB(IRSB *bb , HChar *caller , Bool require_flatness ,   3483 extern void sanityCheckIRSB(IRSB *bb , HChar *caller , Bool require_flatness ,
3484                             IRType guest_word_size ) ;   3484                             IRType guest_word_size ) ;
3485 extern Bool isFlatIRStmt(IRStmt * ) ;   3485 extern Bool isFlatIRStmt(IRStmt * ) ;
3486 extern Bool isPlausibleIRType(IRType ty ) ;   3486 extern Bool isPlausibleIRType(IRType ty ) ;
3487 extern HChar const   *LibVEX_ppVexArch(VexArch  ) ;   3487 extern HChar const   *LibVEX_ppVexArch(VexArch  ) ;
3488 extern HChar const   *LibVEX_ppVexHwCaps(VexArch  , UInt  ) ;   3488 extern HChar const   *LibVEX_ppVexHwCaps(VexArch  , UInt  ) ;
3489 extern void LibVEX_default_VexArchInfo(VexArchInfo *vai ) ;   3489 extern void LibVEX_default_VexArchInfo(VexArchInfo *vai ) ;
3490 extern void LibVEX_default_VexAbiInfo(VexAbiInfo *vbi ) ;   3490 extern void LibVEX_default_VexAbiInfo(VexAbiInfo *vbi ) ;
3491 extern void LibVEX_default_VexControl(VexControl *vcon ) ;   3491 extern void LibVEX_default_VexControl(VexControl *vcon ) ;
3492 extern HChar *private_LibVEX_alloc_first ;   3492 extern HChar *private_LibVEX_alloc_first ;
3493 extern HChar *private_LibVEX_alloc_curr ;   3493 extern HChar *private_LibVEX_alloc_curr ;
3494 extern HChar *private_LibVEX_alloc_last ;   3494 extern HChar *private_LibVEX_alloc_last ;
3495 extern  __attribute__((__noreturn__)) void private_LibVEX_alloc_OOM(void) ;   3495 extern  __attribute__((__noreturn__)) void private_LibVEX_alloc_OOM(void) ;
3496 __inline static void *LibVEX_Alloc(Int nbytes )   3496 __inline static void *LibVEX_Alloc(Int nbytes )
3497 {   3497 {
3498   HChar *curr ;   3498   HChar *curr ;
3499   HChar *next ;   3499   HChar *next ;
3500   Int ALIGN ;   3500   Int ALIGN ;
3501     3501  
3502   {   3502   {
3503   ALIGN = (Int )(sizeof(void *) - 1U);   3503   ALIGN = (Int )(sizeof(void *) - 1U);
3504   nbytes = (nbytes + ALIGN) & ~ ALIGN;   3504   nbytes = (nbytes + ALIGN) & ~ ALIGN;
3505   curr = private_LibVEX_alloc_curr;   3505   curr = private_LibVEX_alloc_curr;
3506   next = curr + nbytes;   3506   next = curr + nbytes;
3507   if ((unsigned int )next >= (unsigned int )private_LibVEX_alloc_last) {   3507   if ((unsigned int )next >= (unsigned int )private_LibVEX_alloc_last) {
3508     private_LibVEX_alloc_OOM();   3508     private_LibVEX_alloc_OOM();
3509   } else {   3509   } else {
3510     3510  
3511   }   3511   }
3512   private_LibVEX_alloc_curr = next;   3512   private_LibVEX_alloc_curr = next;
3513   return ((void *)curr);   3513   return ((void *)curr);
3514 }   3514 }
3515 }   3515 }
3516 extern void LibVEX_ShowAllocStats(void) ;   3516 extern void LibVEX_ShowAllocStats(void) ;
3517 extern void LibVEX_Init( __attribute__((__noreturn__)) void (*failure_exit)(void) ,   3517 extern void LibVEX_Init( __attribute__((__noreturn__)) void (*failure_exit)(void) ,
3518                         void (*log_bytes)(HChar * , Int nbytes ) ,   3518                         void (*log_bytes)(HChar * , Int nbytes ) ,
3519                         Int debuglevel , Bool valgrind_support ,   3519                         Int debuglevel , Bool valgrind_support ,
3520                         VexControl *vcon ) ;   3520                         VexControl *vcon ) ;
3521 extern VexTranslateResult LibVEX_Translate(VexTranslateArgs * ) ;   3521 extern VexTranslateResult LibVEX_Translate(VexTranslateArgs * ) ;
3522 extern void LibVEX_ShowStats(void) ;   3522 extern void LibVEX_ShowStats(void) ;
3523 void (*vgPlain_tl_pre_clo_init)(void) ;   3523 void (*vgPlain_tl_pre_clo_init)(void) ;
3524 extern void vgPlain_basic_tool_funcs(void (*post_clo_init)(void) ,   3524 extern void vgPlain_basic_tool_funcs(void (*post_clo_init)(void) ,
3525                                      IRSB *(*instrument)(VgCallbackClosure *closure ,   3525                                      IRSB *(*instrument)(VgCallbackClosure *closure ,
3526                                                          IRSB *sb_in ,   3526                                                          IRSB *sb_in ,
3527                                                          VexGuestLayout *layout ,   3527                                                          VexGuestLayout *layout ,
3528                                                          VexGuestExtents *vge ,   3528                                                          VexGuestExtents *vge ,
3529                                                          IRType gWordTy ,   3529                                                          IRType gWordTy ,
3530                                                          IRType hWordTy ) ,   3530                                                          IRType hWordTy ) ,
3531                                      void (*fini)(Int  ) ) ;   3531                                      void (*fini)(Int  ) ) ;
3532 extern void vgPlain_details_name(Char *name ) ;   3532 extern void vgPlain_details_name(Char *name ) ;
3533 extern void vgPlain_details_version(Char *version ) ;   3533 extern void vgPlain_details_version(Char *version ) ;
3534 extern void vgPlain_details_description(Char *description ) ;   3534 extern void vgPlain_details_description(Char *description ) ;
3535 extern void vgPlain_details_copyright_author(Char *copyright_author ) ;   3535 extern void vgPlain_details_copyright_author(Char *copyright_author ) ;
3536 extern void vgPlain_details_avg_translation_sizeB(UInt size ) ;   3536 extern void vgPlain_details_avg_translation_sizeB(UInt size ) ;
3537 extern void vgPlain_details_bug_reports_to(Char *bug_reports_to ) ;   3537 extern void vgPlain_details_bug_reports_to(Char *bug_reports_to ) ;
3538 extern void vgPlain_needs_libc_freeres(void) ;   3538 extern void vgPlain_needs_libc_freeres(void) ;
3539 extern void vgPlain_needs_core_errors(void) ;   3539 extern void vgPlain_needs_core_errors(void) ;
3540 extern void vgPlain_needs_tool_errors(Bool (*eq_Error)(VgRes res , Error *e1 ,   3540 extern void vgPlain_needs_tool_errors(Bool (*eq_Error)(VgRes res , Error *e1 ,
3541                                                        Error *e2 ) ,   3541                                                        Error *e2 ) ,
3542                                       void (*before_pp_Error)(Error *err ) ,   3542                                       void (*before_pp_Error)(Error *err ) ,
3543                                       void (*pp_Error)(Error *err ) ,   3543                                       void (*pp_Error)(Error *err ) ,
3544                                       Bool show_ThreadIDs_for_errors ,   3544                                       Bool show_ThreadIDs_for_errors ,
3545                                       UInt (*update_extra)(Error *err ) ,   3545                                       UInt (*update_extra)(Error *err ) ,
3546                                       Bool (*recognised_suppression)(Char *name ,   3546                                       Bool (*recognised_suppression)(Char *name ,
3547                                                                      Supp *su ) ,   3547                                                                      Supp *su ) ,
3548                                       Bool (*read_extra_suppression_info)(Int fd ,   3548                                       Bool (*read_extra_suppression_info)(Int fd ,
3549                                                                           Char **bufpp ,   3549                                                                           Char **bufpp ,
3550                                                                           SizeT *nBufp ,   3550                                                                           SizeT *nBufp ,
3551                                                                           Supp *su ) ,   3551                                                                           Supp *su ) ,
3552                                       Bool (*error_matches_suppression)(Error *err ,   3552                                       Bool (*error_matches_suppression)(Error *err ,
3553                                                                         Supp *su ) ,   3553                                                                         Supp *su ) ,
3554                                       Char *(*get_error_name)(Error *err ) ,   3554                                       Char *(*get_error_name)(Error *err ) ,
3555                                       Bool (*print_extra_suppression_info)(Error *err ,   3555                                       Bool (*print_extra_suppression_info)(Error *err ,
3556                                                                            Char *buf ,   3556                                                                            Char *buf ,
3557                                                                            Int nBuf ) ) ;   3557                                                                            Int nBuf ) ) ;
3558 extern void vgPlain_needs_superblock_discards(void (*discard_superblock_info)(Addr64 orig_addr ,   3558 extern void vgPlain_needs_superblock_discards(void (*discard_superblock_info)(Addr64 orig_addr ,
3559                                                                               VexGuestExtents extents ) ) ;   3559                                                                               VexGuestExtents extents ) ) ;
3560 extern void vgPlain_needs_command_line_options(Bool (*process_cmd_line_option)(Char *argv ) ,   3560 extern void vgPlain_needs_command_line_options(Bool (*process_cmd_line_option)(Char *argv ) ,
3561                                                void (*print_usage)(void) ,   3561                                                void (*print_usage)(void) ,
3562                                                void (*print_debug_usage)(void) ) ;   3562                                                void (*print_debug_usage)(void) ) ;
3563 extern void vgPlain_needs_client_requests(Bool (*handle_client_request)(ThreadId tid ,   3563 extern void vgPlain_needs_client_requests(Bool (*handle_client_request)(ThreadId tid ,
3564                                                                         UWord *arg_block ,   3564                                                                         UWord *arg_block ,
3565                                                                         UWord *ret ) ) ;   3565                                                                         UWord *ret ) ) ;
3566 extern void vgPlain_needs_syscall_wrapper(void (*pre_syscall)(ThreadId tid ,   3566 extern void vgPlain_needs_syscall_wrapper(void (*pre_syscall)(ThreadId tid ,
3567                                                               UInt syscallno ,   3567                                                               UInt syscallno ,
3568                                                               UWord *args ,   3568                                                               UWord *args ,
3569                                                               UInt nArgs ) ,   3569                                                               UInt nArgs ) ,
3570                                           void (*post_syscall)(ThreadId tid ,   3570                                           void (*post_syscall)(ThreadId tid ,
3571                                                                UInt syscallno ,   3571                                                                UInt syscallno ,
3572                                                                UWord *args ,   3572                                                                UWord *args ,
3573                                                                UInt nArgs ,   3573                                                                UInt nArgs ,
3574                                                                SysRes res ) ) ;   3574                                                                SysRes res ) ) ;
3575 extern void vgPlain_needs_sanity_checks(Bool (*cheap_sanity_check)(void) ,   3575 extern void vgPlain_needs_sanity_checks(Bool (*cheap_sanity_check)(void) ,
3576                                         Bool (*expensive_sanity_check)(void) ) ;   3576                                         Bool (*expensive_sanity_check)(void) ) ;
3577 extern void vgPlain_needs_var_info(void) ;   3577 extern void vgPlain_needs_var_info(void) ;
3578 extern void vgPlain_needs_malloc_replacement(void *(*pmalloc)(ThreadId tid ,   3578 extern void vgPlain_needs_malloc_replacement(void *(*pmalloc)(ThreadId tid ,
3579                                                               SizeT n ) ,   3579                                                               SizeT n ) ,
3580                                              void *(*p__builtin_new)(ThreadId tid ,   3580                                              void *(*p__builtin_new)(ThreadId tid ,
3581                                                                      SizeT n ) ,   3581                                                                      SizeT n ) ,
3582                                              void *(*p__builtin_vec_new)(ThreadId tid ,   3582                                              void *(*p__builtin_vec_new)(ThreadId tid ,
3583                                                                          SizeT n ) ,   3583                                                                          SizeT n ) ,
3584                                              void *(*pmemalign)(ThreadId tid ,   3584                                              void *(*pmemalign)(ThreadId tid ,
3585                                                                 SizeT align ,   3585                                                                 SizeT align ,
3586                                                                 SizeT n ) ,   3586                                                                 SizeT n ) ,
3587                                              void *(*pcalloc)(ThreadId tid ,   3587                                              void *(*pcalloc)(ThreadId tid ,
3588                                                               SizeT nmemb ,   3588                                                               SizeT nmemb ,
3589                                                               SizeT size1 ) ,   3589                                                               SizeT size1 ) ,
3590                                              void (*pfree)(ThreadId tid ,   3590                                              void (*pfree)(ThreadId tid ,
3591                                                            void *p ) ,   3591                                                            void *p ) ,
3592                                              void (*p__builtin_delete)(ThreadId tid ,   3592                                              void (*p__builtin_delete)(ThreadId tid ,
3593                                                                        void *p ) ,   3593                                                                        void *p ) ,
3594                                              void (*p__builtin_vec_delete)(ThreadId tid ,   3594                                              void (*p__builtin_vec_delete)(ThreadId tid ,
3595                                                                            void *p ) ,   3595                                                                            void *p ) ,
3596                                              void *(*prealloc)(ThreadId tid ,   3596                                              void *(*prealloc)(ThreadId tid ,
3597                                                                void *p ,   3597                                                                void *p ,
3598                                                                SizeT new_size ) ,   3598                                                                SizeT new_size ) ,
3599                                              SizeT (*pmalloc_usable_size)(ThreadId tid ,   3599                                              SizeT (*pmalloc_usable_size)(ThreadId tid ,
3600                                                                           void *p ) ,   3600                                                                           void *p ) ,
3601                                              SizeT client_malloc_redzone_szB ) ;   3601                                              SizeT client_malloc_redzone_szB ) ;
3602 extern void vgPlain_needs_xml_output(void) ;   3602 extern void vgPlain_needs_xml_output(void) ;
3603 extern void vgPlain_needs_final_IR_tidy_pass(IRSB *(*final_tidy)(IRSB * ) ) ;   3603 extern void vgPlain_needs_final_IR_tidy_pass(IRSB *(*final_tidy)(IRSB * ) ) ;
3604 extern void vgPlain_track_new_mem_startup(void (*f)(Addr a , SizeT len ,   3604 extern void vgPlain_track_new_mem_startup(void (*f)(Addr a , SizeT len ,
3605                                                     Bool rr , Bool ww ,   3605                                                     Bool rr , Bool ww ,
3606                                                     Bool xx , ULong di_handle ) ) ;   3606                                                     Bool xx , ULong di_handle ) ) ;
3607 extern void vgPlain_track_new_mem_stack_signal(void (*f)(Addr a , SizeT len ,   3607 extern void vgPlain_track_new_mem_stack_signal(void (*f)(Addr a , SizeT len ,
3608                                                          ThreadId tid ) ) ;   3608                                                          ThreadId tid ) ) ;
3609 extern void vgPlain_track_new_mem_brk(void (*f)(Addr a , SizeT len ,   3609 extern void vgPlain_track_new_mem_brk(void (*f)(Addr a , SizeT len ,
3610                                                 ThreadId tid ) ) ;   3610                                                 ThreadId tid ) ) ;
3611 extern void vgPlain_track_new_mem_mmap(void (*f)(Addr a , SizeT len , Bool rr ,   3611 extern void vgPlain_track_new_mem_mmap(void (*f)(Addr a , SizeT len , Bool rr ,
3612                                                  Bool ww , Bool xx ,   3612                                                  Bool ww , Bool xx ,
3613                                                  ULong di_handle ) ) ;   3613                                                  ULong di_handle ) ) ;
3614 extern void vgPlain_track_copy_mem_remap(void (*f)(Addr from , Addr to ,   3614 extern void vgPlain_track_copy_mem_remap(void (*f)(Addr from , Addr to ,
3615                                                    SizeT len ) ) ;   3615                                                    SizeT len ) ) ;
3616 extern void vgPlain_track_change_mem_mprotect(void (*f)(Addr a , SizeT len ,   3616 extern void vgPlain_track_change_mem_mprotect(void (*f)(Addr a , SizeT len ,
3617                                                         Bool rr , Bool ww ,   3617                                                         Bool rr , Bool ww ,
3618                                                         Bool xx ) ) ;   3618                                                         Bool xx ) ) ;
3619 extern void vgPlain_track_die_mem_stack_signal(void (*f)(Addr a , SizeT len ) ) ;   3619 extern void vgPlain_track_die_mem_stack_signal(void (*f)(Addr a , SizeT len ) ) ;
3620 extern void vgPlain_track_die_mem_brk(void (*f)(Addr a , SizeT len ) ) ;   3620 extern void vgPlain_track_die_mem_brk(void (*f)(Addr a , SizeT len ) ) ;
3621 extern void vgPlain_track_die_mem_munmap(void (*f)(Addr a , SizeT len ) ) ;   3621 extern void vgPlain_track_die_mem_munmap(void (*f)(Addr a , SizeT len ) ) ;
3622 extern void vgPlain_track_new_mem_stack_4_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,   3622 extern void vgPlain_track_new_mem_stack_4_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,
3623                                                                                              UInt ecu ) ) ;   3623                                                                                              UInt ecu ) ) ;
3624 extern void vgPlain_track_new_mem_stack_8_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,   3624 extern void vgPlain_track_new_mem_stack_8_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,
3625                                                                                              UInt ecu ) ) ;   3625                                                                                              UInt ecu ) ) ;
3626 extern void vgPlain_track_new_mem_stack_12_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,   3626 extern void vgPlain_track_new_mem_stack_12_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,
3627                                                                                               UInt ecu ) ) ;   3627                                                                                               UInt ecu ) ) ;
3628 extern void vgPlain_track_new_mem_stack_16_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,   3628 extern void vgPlain_track_new_mem_stack_16_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,
3629                                                                                               UInt ecu ) ) ;   3629                                                                                               UInt ecu ) ) ;
3630 extern void vgPlain_track_new_mem_stack_32_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,   3630 extern void vgPlain_track_new_mem_stack_32_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,
3631                                                                                               UInt ecu ) ) ;   3631                                                                                               UInt ecu ) ) ;
3632 extern void vgPlain_track_new_mem_stack_112_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,   3632 extern void vgPlain_track_new_mem_stack_112_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,
3633                                                                                                UInt ecu ) ) ;   3633                                                                                                UInt ecu ) ) ;
3634 extern void vgPlain_track_new_mem_stack_128_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,   3634 extern void vgPlain_track_new_mem_stack_128_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,
3635                                                                                                UInt ecu ) ) ;   3635                                                                                                UInt ecu ) ) ;
3636 extern void vgPlain_track_new_mem_stack_144_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,   3636 extern void vgPlain_track_new_mem_stack_144_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,
3637                                                                                                UInt ecu ) ) ;   3637                                                                                                UInt ecu ) ) ;
3638 extern void vgPlain_track_new_mem_stack_160_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,   3638 extern void vgPlain_track_new_mem_stack_160_w_ECU(void ( __attribute__((__regparm__(2))) (*f))(Addr new_ESP ,
3639                                                                                                UInt ecu ) ) ;   3639                                                                                                UInt ecu ) ) ;
3640 extern void vgPlain_track_new_mem_stack_w_ECU(void (*f)(Addr a , SizeT len ,   3640 extern void vgPlain_track_new_mem_stack_w_ECU(void (*f)(Addr a , SizeT len ,
3641                                                         UInt ecu ) ) ;   3641                                                         UInt ecu ) ) ;
3642 extern void vgPlain_track_new_mem_stack_4(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;   3642 extern void vgPlain_track_new_mem_stack_4(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;
3643 extern void vgPlain_track_new_mem_stack_8(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;   3643 extern void vgPlain_track_new_mem_stack_8(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;
3644 extern void vgPlain_track_new_mem_stack_12(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;   3644 extern void vgPlain_track_new_mem_stack_12(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;
3645 extern void vgPlain_track_new_mem_stack_16(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;   3645 extern void vgPlain_track_new_mem_stack_16(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;
3646 extern void vgPlain_track_new_mem_stack_32(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;   3646 extern void vgPlain_track_new_mem_stack_32(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;
3647 extern void vgPlain_track_new_mem_stack_112(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;   3647 extern void vgPlain_track_new_mem_stack_112(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;
3648 extern void vgPlain_track_new_mem_stack_128(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;   3648 extern void vgPlain_track_new_mem_stack_128(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;
3649 extern void vgPlain_track_new_mem_stack_144(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;   3649 extern void vgPlain_track_new_mem_stack_144(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;
3650 extern void vgPlain_track_new_mem_stack_160(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;   3650 extern void vgPlain_track_new_mem_stack_160(void ( __attribute__((__regparm__(1))) (*f))(Addr new_ESP ) ) ;
3651 extern void vgPlain_track_new_mem_stack(void (*f)(Addr a , SizeT len ) ) ;   3651 extern void vgPlain_track_new_mem_stack(void (*f)(Addr a , SizeT len ) ) ;
3652 extern void vgPlain_track_die_mem_stack_4(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;   3652 extern void vgPlain_track_die_mem_stack_4(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;
3653 extern void vgPlain_track_die_mem_stack_8(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;   3653 extern void vgPlain_track_die_mem_stack_8(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;
3654 extern void vgPlain_track_die_mem_stack_12(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;   3654 extern void vgPlain_track_die_mem_stack_12(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;
3655 extern void vgPlain_track_die_mem_stack_16(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;   3655 extern void vgPlain_track_die_mem_stack_16(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;
3656 extern void vgPlain_track_die_mem_stack_32(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;   3656 extern void vgPlain_track_die_mem_stack_32(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;
3657 extern void vgPlain_track_die_mem_stack_112(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;   3657 extern void vgPlain_track_die_mem_stack_112(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;
3658 extern void vgPlain_track_die_mem_stack_128(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;   3658 extern void vgPlain_track_die_mem_stack_128(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;
3659 extern void vgPlain_track_die_mem_stack_144(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;   3659 extern void vgPlain_track_die_mem_stack_144(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;
3660 extern void vgPlain_track_die_mem_stack_160(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;   3660 extern void vgPlain_track_die_mem_stack_160(void ( __attribute__((__regparm__(1))) (*f))(Addr die_ESP ) ) ;
3661 extern void vgPlain_track_die_mem_stack(void (*f)(Addr a , SizeT len ) ) ;   3661 extern void vgPlain_track_die_mem_stack(void (*f)(Addr a , SizeT len ) ) ;
3662 extern void vgPlain_track_ban_mem_stack(void (*f)(Addr a , SizeT len ) ) ;   3662 extern void vgPlain_track_ban_mem_stack(void (*f)(Addr a , SizeT len ) ) ;
3663 extern void vgPlain_track_pre_mem_read(void (*f)(CorePart part , ThreadId tid ,   3663 extern void vgPlain_track_pre_mem_read(void (*f)(CorePart part , ThreadId tid ,
3664                                                  Char *s , Addr a , SizeT size ) ) ;   3664                                                  Char *s , Addr a , SizeT size ) ) ;
3665 extern void vgPlain_track_pre_mem_read_asciiz(void (*f)(CorePart part ,   3665 extern void vgPlain_track_pre_mem_read_asciiz(void (*f)(CorePart part ,
3666                                                         ThreadId tid , Char *s ,   3666                                                         ThreadId tid , Char *s ,
3667                                                         Addr a ) ) ;   3667                                                         Addr a ) ) ;
3668 extern void vgPlain_track_pre_mem_write(void (*f)(CorePart part , ThreadId tid ,   3668 extern void vgPlain_track_pre_mem_write(void (*f)(CorePart part , ThreadId tid ,
3669                                                   Char *s , Addr a , SizeT size ) ) ;   3669                                                   Char *s , Addr a , SizeT size ) ) ;
3670 extern void vgPlain_track_post_mem_write(void (*f)(CorePart part ,   3670 extern void vgPlain_track_post_mem_write(void (*f)(CorePart part ,
3671                                                    ThreadId tid , Addr a ,   3671                                                    ThreadId tid , Addr a ,
3672                                                    SizeT size ) ) ;   3672                                                    SizeT size ) ) ;
3673 extern void vgPlain_track_pre_reg_read(void (*f)(CorePart part , ThreadId tid ,   3673 extern void vgPlain_track_pre_reg_read(void (*f)(CorePart part , ThreadId tid ,
3674                                                  Char *s ,   3674                                                  Char *s ,
3675                                                  PtrdiffT guest_state_offset ,   3675                                                  PtrdiffT guest_state_offset ,
3676                                                  SizeT size ) ) ;   3676                                                  SizeT size ) ) ;
3677 extern void vgPlain_track_post_reg_write(void (*f)(CorePart part ,   3677 extern void vgPlain_track_post_reg_write(void (*f)(CorePart part ,
3678                                                    ThreadId tid ,   3678                                                    ThreadId tid ,
3679                                                    PtrdiffT guest_state_offset ,   3679                                                    PtrdiffT guest_state_offset ,
3680                                                    SizeT size ) ) ;   3680                                                    SizeT size ) ) ;
3681 extern void vgPlain_track_post_reg_write_clientcall_return(void (*f)(ThreadId tid ,   3681 extern void vgPlain_track_post_reg_write_clientcall_return(void (*f)(ThreadId tid ,
3682                                                                      PtrdiffT guest_state_offset ,   3682                                                                      PtrdiffT guest_state_offset ,
3683                                                                      SizeT size ,   3683                                                                      SizeT size ,
3684                                                                      Addr f ) ) ;   3684                                                                      Addr f ) ) ;
3685 extern void vgPlain_track_start_client_code(void (*f)(ThreadId tid ,   3685 extern void vgPlain_track_start_client_code(void (*f)(ThreadId tid ,
3686                                                       ULong blocks_dispatched ) ) ;   3686                                                       ULong blocks_dispatched ) ) ;
3687 extern void vgPlain_track_stop_client_code(void (*f)(ThreadId tid ,   3687 extern void vgPlain_track_stop_client_code(void (*f)(ThreadId tid ,
3688                                                      ULong blocks_dispatched ) ) ;   3688                                                      ULong blocks_dispatched ) ) ;
3689 extern void vgPlain_track_pre_thread_ll_create(void (*f)(ThreadId tid ,   3689 extern void vgPlain_track_pre_thread_ll_create(void (*f)(ThreadId tid ,
3690                                                          ThreadId child ) ) ;   3690                                                          ThreadId child ) ) ;
3691 extern void vgPlain_track_pre_thread_first_insn(void (*f)(ThreadId tid ) ) ;   3691 extern void vgPlain_track_pre_thread_first_insn(void (*f)(ThreadId tid ) ) ;
3692 extern void vgPlain_track_pre_thread_ll_exit(void (*f)(ThreadId tid ) ) ;   3692 extern void vgPlain_track_pre_thread_ll_exit(void (*f)(ThreadId tid ) ) ;
3693 extern void vgPlain_track_pre_deliver_signal(void (*f)(ThreadId tid ,   3693 extern void vgPlain_track_pre_deliver_signal(void (*f)(ThreadId tid ,
3694                                                        Int sigNo ,   3694                                                        Int sigNo ,
3695                                                        Bool alt_stack ) ) ;   3695                                                        Bool alt_stack ) ) ;
3696 extern void vgPlain_track_post_deliver_signal(void (*f)(ThreadId tid ,   3696 extern void vgPlain_track_post_deliver_signal(void (*f)(ThreadId tid ,
3697                                                         Int sigNo ) ) ;   3697                                                         Int sigNo ) ) ;
3698 extern VgHashTable vgPlain_HT_construct(HChar *name ) ;   3698 extern VgHashTable vgPlain_HT_construct(HChar *name ) ;
3699 extern Int vgPlain_HT_count_nodes(VgHashTable table ) ;   3699 extern Int vgPlain_HT_count_nodes(VgHashTable table ) ;
3700 extern void vgPlain_HT_add_node(VgHashTable t , void *node ) ;   3700 extern void vgPlain_HT_add_node(VgHashTable t , void *node ) ;
3701 extern void *vgPlain_HT_lookup(VgHashTable table , UWord key ) ;   3701 extern void *vgPlain_HT_lookup(VgHashTable table , UWord key ) ;
3702 extern void *vgPlain_HT_remove(VgHashTable table , UWord key ) ;   3702 extern void *vgPlain_HT_remove(VgHashTable table , UWord key ) ;
3703 extern VgHashNode **vgPlain_HT_to_array(VgHashTable t , UInt *n_elems ) ;   3703 extern VgHashNode **vgPlain_HT_to_array(VgHashTable t , UInt *n_elems ) ;
3704 extern void vgPlain_HT_ResetIter(VgHashTable table ) ;   3704 extern void vgPlain_HT_ResetIter(VgHashTable table ) ;
3705 extern void *vgPlain_HT_Next(VgHashTable table ) ;   3705 extern void *vgPlain_HT_Next(VgHashTable table ) ;
3706 extern void vgPlain_HT_destruct(VgHashTable t ) ;   3706 extern void vgPlain_HT_destruct(VgHashTable t ) ;
3707 extern void *vgPlain_cli_malloc(SizeT align , SizeT nbytes ) ;   3707 extern void *vgPlain_cli_malloc(SizeT align , SizeT nbytes ) ;
3708 extern void vgPlain_cli_free(void *p ) ;   3708 extern void vgPlain_cli_free(void *p ) ;
3709 extern Long vgPlain_free_queue_volume ;   3709 extern Long vgPlain_free_queue_volume ;
3710 extern Long vgPlain_free_queue_length ;   3710 extern Long vgPlain_free_queue_length ;
3711 extern Bool vgPlain_addr_is_in_block(Addr a , Addr start , SizeT size ,   3711 extern Bool vgPlain_addr_is_in_block(Addr a , Addr start , SizeT size ,
3712                                      SizeT rz_szB ) ;   3712                                      SizeT rz_szB ) ;
3713 extern Bool vgPlain_clo_trace_malloc ;   3713 extern Bool vgPlain_clo_trace_malloc ;
3714 extern UInt vgPlain_clo_alignment ;   3714 extern UInt vgPlain_clo_alignment ;
3715 extern Bool vgPlain_replacement_malloc_process_cmd_line_option(Char *arg ) ;   3715 extern Bool vgPlain_replacement_malloc_process_cmd_line_option(Char *arg ) ;
3716 extern Addr vgPlain_get_IP(ThreadId tid ) ;   3716 extern Addr vgPlain_get_IP(ThreadId tid ) ;
3717 extern Addr vgPlain_get_SP(ThreadId tid ) ;   3717 extern Addr vgPlain_get_SP(ThreadId tid ) ;
3718 extern void vgPlain_get_shadow_regs_area(ThreadId tid , UChar *dst ,   3718 extern void vgPlain_get_shadow_regs_area(ThreadId tid , UChar *dst ,
3719                                          Int shadowNo , PtrdiffT offset ,   3719                                          Int shadowNo , PtrdiffT offset ,
3720                                          SizeT size ) ;   3720                                          SizeT size ) ;
3721 extern void vgPlain_set_shadow_regs_area(ThreadId tid , Int shadowNo ,   3721 extern void vgPlain_set_shadow_regs_area(ThreadId tid , Int shadowNo ,
3722                                          PtrdiffT offset , SizeT size ,   3722                                          PtrdiffT offset , SizeT size ,
3723                                          UChar const   *src ) ;   3723                                          UChar const   *src ) ;
3724 extern void vgPlain_set_syscall_return_shadows(ThreadId tid , UWord s1res ,   3724 extern void vgPlain_set_syscall_return_shadows(ThreadId tid , UWord s1res ,
3725                                                UWord s2res , UWord s1err ,   3725                                                UWord s2res , UWord s1err ,
3726                                                UWord s2err ) ;   3726                                                UWord s2err ) ;
3727 extern void vgPlain_apply_to_GP_regs(void (*f)(UWord val ) ) ;   3727 extern void vgPlain_apply_to_GP_regs(void (*f)(UWord val ) ) ;
3728 extern void vgPlain_thread_stack_reset_iter(ThreadId *tid ) ;   3728 extern void vgPlain_thread_stack_reset_iter(ThreadId *tid ) ;
3729 extern Bool vgPlain_thread_stack_next(ThreadId *tid , Addr *stack_min ,   3729 extern Bool vgPlain_thread_stack_next(ThreadId *tid , Addr *stack_min ,
3730                                       Addr *stack_max ) ;   3730                                       Addr *stack_max ) ;
3731 extern Addr vgPlain_thread_get_stack_max(ThreadId tid ) ;   3731 extern Addr vgPlain_thread_get_stack_max(ThreadId tid ) ;
3732 extern SizeT vgPlain_thread_get_stack_size(ThreadId tid ) ;   3732 extern SizeT vgPlain_thread_get_stack_size(ThreadId tid ) ;
3733 extern Addr vgPlain_thread_get_altstack_min(ThreadId tid ) ;   3733 extern Addr vgPlain_thread_get_altstack_min(ThreadId tid ) ;
3734 extern SizeT vgPlain_thread_get_altstack_size(ThreadId tid ) ;   3734 extern SizeT vgPlain_thread_get_altstack_size(ThreadId tid ) ;
3735 extern void *vgPlain_fnptr_to_fnentry(void * ) ;   3735 extern void *vgPlain_fnptr_to_fnentry(void * ) ;
3736 extern Int vgPlain_clo_verbosity ;   3736 extern Int vgPlain_clo_verbosity ;
3737 extern Bool vgPlain_clo_stats ;   3737 extern Bool vgPlain_clo_stats ;
3738 extern Bool vgPlain_clo_xml ;   3738 extern Bool vgPlain_clo_xml ;
3739 extern HChar *vgPlain_clo_xml_user_comment ;   3739 extern HChar *vgPlain_clo_xml_user_comment ;
3740 extern VexControl vgPlain_clo_vex_control ;   3740 extern VexControl vgPlain_clo_vex_control ;
3741 extern Int vgPlain_clo_backtrace_size ;   3741 extern Int vgPlain_clo_backtrace_size ;
3742 extern Bool vgPlain_clo_show_below_main ;   3742 extern Bool vgPlain_clo_show_below_main ;
3743 extern Char *vgPlain_expand_file_name(Char *option_name , Char *format ) ;   3743 extern Char *vgPlain_expand_file_name(Char *option_name , Char *format ) ;
3744 extern XArray *vgPlain_newXA(void *(*alloc_fn)(HChar * , SizeT  ) , HChar *cc ,   3744 extern XArray *vgPlain_newXA(void *(*alloc_fn)(HChar * , SizeT  ) , HChar *cc ,
3745                              void (*free_fn)(void * ) , Word elemSzB ) ;   3745                              void (*free_fn)(void * ) , Word elemSzB ) ;
3746 extern void vgPlain_deleteXA(XArray * ) ;   3746 extern void vgPlain_deleteXA(XArray * ) ;
3747 extern void vgPlain_setCmpFnXA(XArray * , Int (*compar)(void * , void * ) ) ;   3747 extern void vgPlain_setCmpFnXA(XArray * , Int (*compar)(void * , void * ) ) ;
3748 extern Word vgPlain_addToXA(XArray * , void *elem ) ;   3748 extern Word vgPlain_addToXA(XArray * , void *elem ) ;
3749 extern Word vgPlain_addBytesToXA(XArray *xao , void *bytesV , Word nbytes ) ;   3749 extern Word vgPlain_addBytesToXA(XArray *xao , void *bytesV , Word nbytes ) ;
3750 extern void vgPlain_sortXA(XArray * ) ;   3750 extern void vgPlain_sortXA(XArray * ) ;
3751 extern Bool vgPlain_lookupXA(XArray * , void *key , Word *first , Word *last ) ;   3751 extern Bool vgPlain_lookupXA(XArray * , void *key , Word *first , Word *last ) ;
3752 extern Bool vgPlain_lookupXA_UNSAFE(XArray *xao , void *key , Word *first ,   3752 extern Bool vgPlain_lookupXA_UNSAFE(XArray *xao , void *key , Word *first ,
3753                                     Word *last , Int (*cmpFn)(void * , void * ) ) ;   3753                                     Word *last , Int (*cmpFn)(void * , void * ) ) ;
3754 extern Word vgPlain_sizeXA(XArray * ) ;   3754 extern Word vgPlain_sizeXA(XArray * ) ;
3755 extern void *vgPlain_indexXA(XArray * , Word  ) ;   3755 extern void *vgPlain_indexXA(XArray * , Word  ) ;
3756 extern void vgPlain_dropTailXA(XArray * , Word  ) ;   3756 extern void vgPlain_dropTailXA(XArray * , Word  ) ;
3757 extern void vgPlain_dropHeadXA(XArray * , Word  ) ;   3757 extern void vgPlain_dropHeadXA(XArray * , Word  ) ;
3758 extern XArray *vgPlain_cloneXA(HChar *cc , XArray *xa ) ;   3758 extern XArray *vgPlain_cloneXA(HChar *cc , XArray *xa ) ;
3759 extern void vgPlain_getContentsXA_UNSAFE(XArray *sr , void **ctsP , Word *usedP ) ;   3759 extern void vgPlain_getContentsXA_UNSAFE(XArray *sr , void **ctsP , Word *usedP ) ;
3760 extern void ( /* format attribute */  vgPlain_xaprintf)(XArray *dst ,   3760 extern void ( /* format attribute */  vgPlain_xaprintf)(XArray *dst ,
3761                                                         HChar const   *format   3761                                                         HChar const   *format
3762                                                         , ...) ;   3762                                                         , ...) ;
3763 extern void vgPlain_xaprintf_no_f_c(XArray *dst , HChar const   *format  , ...) ;   3763 extern void vgPlain_xaprintf_no_f_c(XArray *dst , HChar const   *format  , ...) ;
3764 extern UInt vgPlain_get_StackTrace(ThreadId tid , StackTrace ips , UInt n_ips ,   3764 extern UInt vgPlain_get_StackTrace(ThreadId tid , StackTrace ips , UInt n_ips ,
3765                                    StackTrace sps , StackTrace fps ,   3765                                    StackTrace sps , StackTrace fps ,
3766                                    Word first_ip_delta ) ;   3766                                    Word first_ip_delta ) ;
3767 extern void vgPlain_apply_StackTrace(void (*action)(UInt n , Addr ip ,   3767 extern void vgPlain_apply_StackTrace(void (*action)(UInt n , Addr ip ,
3768                                                     void *opaque ) ,   3768                                                     void *opaque ) ,
3769                                      void *opaque , StackTrace ips , UInt n_ips ) ;   3769                                      void *opaque , StackTrace ips , UInt n_ips ) ;
3770 extern void vgPlain_pp_StackTrace(StackTrace ips , UInt n_ips ) ;   3770 extern void vgPlain_pp_StackTrace(StackTrace ips , UInt n_ips ) ;
3771 extern void vgPlain_get_and_pp_StackTrace(ThreadId tid , UInt n_ips ) ;   3771 extern void vgPlain_get_and_pp_StackTrace(ThreadId tid , UInt n_ips ) ;
3772 extern WordFM *vgPlain_newFM(void *(*alloc_nofail)(HChar *cc , SizeT  ) ,   3772 extern WordFM *vgPlain_newFM(void *(*alloc_nofail)(HChar *cc , SizeT  ) ,
3773                              HChar *cc , void (*dealloc)(void * ) ,   3773                              HChar *cc , void (*dealloc)(void * ) ,
3774                              Word (*kCmp)(UWord  , UWord  ) ) ;   3774                              Word (*kCmp)(UWord  , UWord  ) ) ;
3775 extern void vgPlain_deleteFM(WordFM * , void (*kFin)(UWord  ) ,   3775 extern void vgPlain_deleteFM(WordFM * , void (*kFin)(UWord  ) ,
3776                              void (*vFin)(UWord  ) ) ;   3776                              void (*vFin)(UWord  ) ) ;
3777 extern Bool vgPlain_addToFM(WordFM *fm , UWord k , UWord v ) ;   3777 extern Bool vgPlain_addToFM(WordFM *fm , UWord k , UWord v ) ;
3778 extern Bool vgPlain_delFromFM(WordFM *fm , UWord *oldK , UWord *oldV ,   3778 extern Bool vgPlain_delFromFM(WordFM *fm , UWord *oldK , UWord *oldV ,
3779                               UWord key ) ;   3779                               UWord key ) ;
3780 extern Bool vgPlain_lookupFM(WordFM *fm , UWord *keyP , UWord *valP , UWord key ) ;   3780 extern Bool vgPlain_lookupFM(WordFM *fm , UWord *keyP , UWord *valP , UWord key ) ;
3781 extern Bool vgPlain_findBoundsFM(WordFM *fm , UWord *kMinP , UWord *vMinP ,   3781 extern Bool vgPlain_findBoundsFM(WordFM *fm , UWord *kMinP , UWord *vMinP ,
3782                                  UWord *kMaxP , UWord *vMaxP , UWord minKey ,   3782                                  UWord *kMaxP , UWord *vMaxP , UWord minKey ,
3783                                  UWord minVal , UWord maxKey , UWord maxVal ,   3783                                  UWord minVal , UWord maxKey , UWord maxVal ,
3784                                  UWord key ) ;   3784                                  UWord key ) ;
3785 extern UWord vgPlain_sizeFM(WordFM *fm ) ;   3785 extern UWord vgPlain_sizeFM(WordFM *fm ) ;
3786 extern void vgPlain_initIterFM(WordFM *fm ) ;   3786 extern void vgPlain_initIterFM(WordFM *fm ) ;
3787 extern void vgPlain_initIterAtFM(WordFM *fm , UWord start_at ) ;   3787 extern void vgPlain_initIterAtFM(WordFM *fm , UWord start_at ) ;
3788 extern Bool vgPlain_nextIterFM(WordFM *fm , UWord *pKey , UWord *pVal ) ;   3788 extern Bool vgPlain_nextIterFM(WordFM *fm , UWord *pKey , UWord *pVal ) ;
3789 extern void vgPlain_doneIterFM(WordFM *fm ) ;   3789 extern void vgPlain_doneIterFM(WordFM *fm ) ;
3790 extern WordFM *vgPlain_dopyFM(WordFM *fm , UWord (*dopyK)(UWord  ) ,   3790 extern WordFM *vgPlain_dopyFM(WordFM *fm , UWord (*dopyK)(UWord  ) ,
3791                               UWord (*dopyV)(UWord  ) ) ;   3791                               UWord (*dopyV)(UWord  ) ) ;
3792 extern SizeT vgPlain_getNodeSizeFM(void) ;   3792 extern SizeT vgPlain_getNodeSizeFM(void) ;
3793 extern WordBag *vgPlain_newBag(void *(*alloc_nofail)(HChar *cc , SizeT  ) ,   3793 extern WordBag *vgPlain_newBag(void *(*alloc_nofail)(HChar *cc , SizeT  ) ,
3794                                HChar *cc , void (*dealloc)(void * ) ) ;   3794                                HChar *cc , void (*dealloc)(void * ) ) ;
3795 extern void vgPlain_deleteBag(WordBag * ) ;   3795 extern void vgPlain_deleteBag(WordBag * ) ;
3796 extern void vgPlain_addToBag(WordBag * , UWord  ) ;   3796 extern void vgPlain_addToBag(WordBag * , UWord  ) ;
3797 extern UWord vgPlain_elemBag(WordBag * , UWord  ) ;   3797 extern UWord vgPlain_elemBag(WordBag * , UWord  ) ;
3798 extern Bool vgPlain_delFromBag(WordBag * , UWord  ) ;   3798 extern Bool vgPlain_delFromBag(WordBag * , UWord  ) ;
3799 extern Bool vgPlain_isEmptyBag(WordBag * ) ;   3799 extern Bool vgPlain_isEmptyBag(WordBag * ) ;
3800 extern Bool vgPlain_isSingletonTotalBag(WordBag * ) ;   3800 extern Bool vgPlain_isSingletonTotalBag(WordBag * ) ;
3801 extern UWord vgPlain_anyElementOfBag(WordBag * ) ;   3801 extern UWord vgPlain_anyElementOfBag(WordBag * ) ;
3802 extern UWord vgPlain_sizeUniqueBag(WordBag * ) ;   3802 extern UWord vgPlain_sizeUniqueBag(WordBag * ) ;
3803 extern UWord vgPlain_sizeTotalBag(WordBag * ) ;   3803 extern UWord vgPlain_sizeTotalBag(WordBag * ) ;
3804 extern void vgPlain_initIterBag(WordBag * ) ;   3804 extern void vgPlain_initIterBag(WordBag * ) ;
3805 extern Bool vgPlain_nextIterBag(WordBag * , UWord *pVal , UWord *pCount ) ;   3805 extern Bool vgPlain_nextIterBag(WordBag * , UWord *pVal , UWord *pCount ) ;
3806 extern void vgPlain_doneIterBag(WordBag * ) ;   3806 extern void vgPlain_doneIterBag(WordBag * ) ;
3807 extern Bool vgPlain_get_filename(Addr a , Char *filename , Int n_filename ) ;   3807 extern Bool vgPlain_get_filename(Addr a , Char *filename , Int n_filename ) ;
3808 extern Bool vgPlain_get_fnname(Addr a , Char *fnname , Int n_fnname ) ;   3808 extern Bool vgPlain_get_fnname(Addr a , Char *fnname , Int n_fnname ) ;
3809 extern Bool vgPlain_get_linenum(Addr a , UInt *linenum ) ;   3809 extern Bool vgPlain_get_linenum(Addr a , UInt *linenum ) ;
3810 extern Bool vgPlain_get_fnname_w_offset(Addr a , Char *fnname , Int n_fnname ) ;   3810 extern Bool vgPlain_get_fnname_w_offset(Addr a , Char *fnname , Int n_fnname ) ;
3811 extern Bool vgPlain_get_filename_linenum(Addr a , Char *filename ,   3811 extern Bool vgPlain_get_filename_linenum(Addr a , Char *filename ,
3812                                          Int n_filename , Char *dirname ,   3812                                          Int n_filename , Char *dirname ,
3813                                          Int n_dirname ,   3813                                          Int n_dirname ,
3814                                          Bool *dirname_available ,   3814                                          Bool *dirname_available ,
3815                                          UInt *linenum ) ;   3815                                          UInt *linenum ) ;
3816 extern Bool vgPlain_get_fnname_if_entry(Addr a , Char *fnname , Int n_fnname ) ;   3816 extern Bool vgPlain_get_fnname_if_entry(Addr a , Char *fnname , Int n_fnname ) ;
3817 extern Vg_FnNameKind vgPlain_get_fnname_kind(Char *name ) ;   3817 extern Vg_FnNameKind vgPlain_get_fnname_kind(Char *name ) ;
3818 extern Vg_FnNameKind vgPlain_get_fnname_kind_from_IP(Addr ip ) ;   3818 extern Vg_FnNameKind vgPlain_get_fnname_kind_from_IP(Addr ip ) ;
3819 extern Bool vgPlain_get_datasym_and_offset(Addr data_addr , Char *dname ,   3819 extern Bool vgPlain_get_datasym_and_offset(Addr data_addr , Char *dname ,
3820                                            Int n_dname , PtrdiffT *offset ) ;   3820                                            Int n_dname , PtrdiffT *offset ) ;
3821 extern Bool vgPlain_get_data_description(void *dname1v , void *dname2v ,   3821 extern Bool vgPlain_get_data_description(void *dname1v , void *dname2v ,
3822                                          Addr data_addr ) ;   3822                                          Addr data_addr ) ;
3823 extern Bool vgPlain_get_objname(Addr a , Char *objname , Int n_objname ) ;   3823 extern Bool vgPlain_get_objname(Addr a , Char *objname , Int n_objname ) ;
3824 extern Char *vgPlain_describe_IP(Addr eip , Char *buf , Int n_buf ) ;   3824 extern Char *vgPlain_describe_IP(Addr eip , Char *buf , Int n_buf ) ;
3825 extern void *vgPlain_di_get_stack_blocks_at_ip(Addr ip , Bool arrays_only ) ;   3825 extern void *vgPlain_di_get_stack_blocks_at_ip(Addr ip , Bool arrays_only ) ;
3826 extern void *vgPlain_di_get_global_blocks_from_dihandle(ULong di_handle ,   3826 extern void *vgPlain_di_get_global_blocks_from_dihandle(ULong di_handle ,
3827                                                         Bool arrays_only ) ;   3827                                                         Bool arrays_only ) ;
3828 extern DebugInfo *vgPlain_find_DebugInfo(Addr a ) ;   3828 extern DebugInfo *vgPlain_find_DebugInfo(Addr a ) ;
3829 extern Addr vgPlain_DebugInfo_get_text_avma(DebugInfo const   *di ) ;   3829 extern Addr vgPlain_DebugInfo_get_text_avma(DebugInfo const   *di ) ;
3830 extern SizeT vgPlain_DebugInfo_get_text_size(DebugInfo const   *di ) ;   3830 extern SizeT vgPlain_DebugInfo_get_text_size(DebugInfo const   *di ) ;
3831 extern Addr vgPlain_DebugInfo_get_plt_avma(DebugInfo const   *di ) ;   3831 extern Addr vgPlain_DebugInfo_get_plt_avma(DebugInfo const   *di ) ;
3832 extern SizeT vgPlain_DebugInfo_get_plt_size(DebugInfo const   *di ) ;   3832 extern SizeT vgPlain_DebugInfo_get_plt_size(DebugInfo const   *di ) ;
3833 extern Addr vgPlain_DebugInfo_get_gotplt_avma(DebugInfo const   *di ) ;   3833 extern Addr vgPlain_DebugInfo_get_gotplt_avma(DebugInfo const   *di ) ;
3834 extern SizeT vgPlain_DebugInfo_get_gotplt_size(DebugInfo const   *di ) ;   3834 extern SizeT vgPlain_DebugInfo_get_gotplt_size(DebugInfo const   *di ) ;
3835 extern UChar const   *vgPlain_DebugInfo_get_soname(DebugInfo const   *di ) ;   3835 extern UChar const   *vgPlain_DebugInfo_get_soname(DebugInfo const   *di ) ;
3836 extern UChar const   *vgPlain_DebugInfo_get_filename(DebugInfo const   *di ) ;   3836 extern UChar const   *vgPlain_DebugInfo_get_filename(DebugInfo const   *di ) ;
3837 extern PtrdiffT vgPlain_DebugInfo_get_text_bias(DebugInfo const   *di ) ;   3837 extern PtrdiffT vgPlain_DebugInfo_get_text_bias(DebugInfo const   *di ) ;
3838 extern DebugInfo const   *vgPlain_next_DebugInfo(DebugInfo const   *di ) ;   3838 extern DebugInfo const   *vgPlain_next_DebugInfo(DebugInfo const   *di ) ;
3839 extern Int vgPlain_DebugInfo_syms_howmany(DebugInfo const   *di ) ;   3839 extern Int vgPlain_DebugInfo_syms_howmany(DebugInfo const   *di ) ;
3840 extern void vgPlain_DebugInfo_syms_getidx(DebugInfo const   *di , Int idx ,   3840 extern void vgPlain_DebugInfo_syms_getidx(DebugInfo const   *di , Int idx ,
3841                                           Addr *avma , Addr *tocptr ,   3841                                           Addr *avma , Addr *tocptr ,
3842                                           UInt *size , HChar **name ,   3842                                           UInt *size , HChar **name ,
3843                                           Bool *isText , Bool *isIFunc ) ;   3843                                           Bool *isText , Bool *isIFunc ) ;
3844 extern HChar const   *vgPlain_pp_SectKind(VgSectKind kind ) ;   3844 extern HChar const   *vgPlain_pp_SectKind(VgSectKind kind ) ;
3845 extern VgSectKind vgPlain_DebugInfo_sect_kind(UChar *name , SizeT n_name ,   3845 extern VgSectKind vgPlain_DebugInfo_sect_kind(UChar *name , SizeT n_name ,
3846                                               Addr a ) ;   3846                                               Addr a ) ;
3847 __inline static struct vki_cmsghdr *__vki_cmsg_nxthdr(void *__ctl ,   3847 __inline static struct vki_cmsghdr *__vki_cmsg_nxthdr(void *__ctl ,
3848                                                       __vki_kernel_size_t __size ,   3848                                                       __vki_kernel_size_t __size ,
3849                                                       struct vki_cmsghdr *__cmsg )   3849                                                       struct vki_cmsghdr *__cmsg )
3850 {   3850 {
3851   struct vki_cmsghdr *__ptr ;   3851   struct vki_cmsghdr *__ptr ;
3852     3852  
3853   {   3853   {
3854   __ptr = (struct vki_cmsghdr *)((unsigned char *)__cmsg + (((__cmsg->cmsg_len + sizeof(long )) - 1U) & ~ (sizeof(long ) - 1U)));   3854   __ptr = (struct vki_cmsghdr *)((unsigned char *)__cmsg + (((__cmsg->cmsg_len + sizeof(long )) - 1U) & ~ (sizeof(long ) - 1U)));
3855   if ((unsigned long )((char *)(__ptr + 1) - (char *)__ctl) > (unsigned long )__size) {   3855   if ((unsigned long )((char *)(__ptr + 1) - (char *)__ctl) > (unsigned long )__size) {
3856     return ((struct vki_cmsghdr *)0);   3856     return ((struct vki_cmsghdr *)0);
3857   } else {   3857   } else {
3858     3858  
3859   }   3859   }
3860   return (__ptr);   3860   return (__ptr);
3861 }   3861 }
3862 }   3862 }
3863 __inline static struct vki_cmsghdr *vki_cmsg_nxthdr(struct vki_msghdr *__msg ,   3863 __inline static struct vki_cmsghdr *vki_cmsg_nxthdr(struct vki_msghdr *__msg ,
3864                                                     struct vki_cmsghdr *__cmsg )   3864                                                     struct vki_cmsghdr *__cmsg )
3865 {   3865 {
3866   struct vki_cmsghdr *tmp ;   3866   struct vki_cmsghdr *tmp ;
3867     3867  
3868   {   3868   {
3869   tmp = __vki_cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg);   3869   tmp = __vki_cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg);
3870   return (tmp);   3870   return (tmp);
3871 }   3871 }
3872 }   3872 }
3873 extern Char **vgPlain_client_envp ;   3873 extern Char **vgPlain_client_envp ;
3874 extern Char *vgPlain_getenv(Char *name ) ;   3874 extern Char *vgPlain_getenv(Char *name ) ;
3875 extern Char const   *vgPlain_libdir ;   3875 extern Char const   *vgPlain_libdir ;
3876 extern Char const   *vgPlain_LD_PRELOAD_var_name ;   3876 extern Char const   *vgPlain_LD_PRELOAD_var_name ;
3877 extern Int vgPlain_waitpid(Int pid , Int *status , Int options ) ;   3877 extern Int vgPlain_waitpid(Int pid , Int *status , Int options ) ;
3878 extern Int vgPlain_system(Char *cmd ) ;   3878 extern Int vgPlain_system(Char *cmd ) ;
3879 extern Int vgPlain_fork(void) ;   3879 extern Int vgPlain_fork(void) ;
3880 extern void vgPlain_execv(Char *filename , Char **argv ) ;   3880 extern void vgPlain_execv(Char *filename , Char **argv ) ;
3881 extern Int vgPlain_getrlimit(Int resource , struct vki_rlimit *rlim ) ;   3881 extern Int vgPlain_getrlimit(Int resource , struct vki_rlimit *rlim ) ;
3882 extern Int vgPlain_setrlimit(Int resource , struct vki_rlimit  const  *rlim ) ;   3882 extern Int vgPlain_setrlimit(Int resource , struct vki_rlimit  const  *rlim ) ;
3883 extern Int vgPlain_gettid(void) ;   3883 extern Int vgPlain_gettid(void) ;
3884 extern Int vgPlain_getpid(void) ;   3884 extern Int vgPlain_getpid(void) ;
3885 extern Int vgPlain_getppid(void) ;   3885 extern Int vgPlain_getppid(void) ;
3886 extern Int vgPlain_getpgrp(void) ;   3886 extern Int vgPlain_getpgrp(void) ;
3887 extern Int vgPlain_geteuid(void) ;   3887 extern Int vgPlain_geteuid(void) ;
3888 extern Int vgPlain_getegid(void) ;   3888 extern Int vgPlain_getegid(void) ;
3889 extern UInt vgPlain_read_millisecond_timer(void) ;   3889 extern UInt vgPlain_read_millisecond_timer(void) ;
3890 extern void vgPlain_atfork(void (*pre)(ThreadId  ) ,   3890 extern void vgPlain_atfork(void (*pre)(ThreadId  ) ,
3891                            void (*parent)(ThreadId  ) ,   3891                            void (*parent)(ThreadId  ) ,
3892                            void (*child)(ThreadId  ) ) ;   3892                            void (*child)(ThreadId  ) ) ;
3893 extern Int vgPlain_am_get_segment_starts(Addr *starts , Int nStarts ) ;   3893 extern Int vgPlain_am_get_segment_starts(Addr *starts , Int nStarts ) ;
3894 extern NSegment const   *vgPlain_am_find_nsegment(Addr a ) ;   3894 extern NSegment const   *vgPlain_am_find_nsegment(Addr a ) ;
3895 extern HChar *vgPlain_am_get_filename(NSegment const   * ) ;   3895 extern HChar *vgPlain_am_get_filename(NSegment const   * ) ;
3896 extern Bool vgPlain_am_is_valid_for_client(Addr start , SizeT len , UInt prot ) ;   3896 extern Bool vgPlain_am_is_valid_for_client(Addr start , SizeT len , UInt prot ) ;
3897 extern void *vgPlain_am_shadow_alloc(SizeT size ) ;   3897 extern void *vgPlain_am_shadow_alloc(SizeT size ) ;
3898 extern SysRes vgPlain_am_munmap_valgrind(Addr start , SizeT length ) ;   3898 extern SysRes vgPlain_am_munmap_valgrind(Addr start , SizeT length ) ;
3899 extern void *vgHelgrind_zalloc(HChar *cc , SizeT n ) ;   3899 extern void *vgHelgrind_zalloc(HChar *cc , SizeT n ) ;
3900 extern void vgHelgrind_free(void *p ) ;   3900 extern void vgHelgrind_free(void *p ) ;
3901 extern Char *vgHelgrind_strdup(HChar *cc , Char const   *s ) ;   3901 extern Char *vgHelgrind_strdup(HChar *cc , Char const   *s ) ;
3902 __inline static Bool vgHelgrind_is_sane_ThreadId(ThreadId coretid )   3902 __inline static Bool vgHelgrind_is_sane_ThreadId(ThreadId coretid )
3903 {   3903 {
3904   int tmp ;   3904   int tmp ;
3905     3905  
3906   {   3906   {
3907   if (coretid >= 0U) {   3907   if (coretid >= 0U) {
3908     if (coretid < 500U) {   3908     if (coretid < 500U) {
3909       tmp = 1;   3909       tmp = 1;
3910     } else {   3910     } else {
3911       tmp = 0;   3911       tmp = 0;
3912     }   3912     }
3913   } else {   3913   } else {
3914     tmp = 0;   3914     tmp = 0;
3915   }   3915   }
3916   return ((Bool )tmp);   3916   return ((Bool )tmp);
3917 }   3917 }
3918 }   3918 }
3919 extern Bool vgHelgrind_clo_track_lockorders ;   3919 extern Bool vgHelgrind_clo_track_lockorders ;
3920 extern Bool vgHelgrind_clo_cmp_race_err_addrs ;   3920 extern Bool vgHelgrind_clo_cmp_race_err_addrs ;
3921 extern UWord vgHelgrind_clo_history_level ;   3921 extern UWord vgHelgrind_clo_history_level ;
3922 extern UWord vgHelgrind_clo_conflict_cache_size ;   3922 extern UWord vgHelgrind_clo_conflict_cache_size ;
3923 extern Word vgHelgrind_clo_sanity_flags ;   3923 extern Word vgHelgrind_clo_sanity_flags ;
3924 extern WordSetU *vgHelgrind_newWordSetU(void *(*alloc_nofail)(HChar * , SizeT  ) ,   3924 extern WordSetU *vgHelgrind_newWordSetU(void *(*alloc_nofail)(HChar * , SizeT  ) ,
3925                                         HChar *cc , void (*dealloc)(void * ) ,   3925                                         HChar *cc , void (*dealloc)(void * ) ,
3926                                         Word cacheSize ) ;   3926                                         Word cacheSize ) ;
3927 extern void vgHelgrind_deleteWordSetU(WordSetU * ) ;   3927 extern void vgHelgrind_deleteWordSetU(WordSetU * ) ;
3928 extern UWord vgHelgrind_cardinalityWSU(WordSetU * ) ;   3928 extern UWord vgHelgrind_cardinalityWSU(WordSetU * ) ;
3929 extern void vgHelgrind_ppWSUstats(WordSetU *wsu , HChar *name ) ;   3929 extern void vgHelgrind_ppWSUstats(WordSetU *wsu , HChar *name ) ;
3930 extern WordSet vgHelgrind_emptyWS(WordSetU * ) ;   3930 extern WordSet vgHelgrind_emptyWS(WordSetU * ) ;
3931 extern WordSet vgHelgrind_addToWS(WordSetU * , WordSet  , UWord  ) ;   3931 extern WordSet vgHelgrind_addToWS(WordSetU * , WordSet  , UWord  ) ;
3932 extern WordSet vgHelgrind_delFromWS(WordSetU * , WordSet  , UWord  ) ;   3932 extern WordSet vgHelgrind_delFromWS(WordSetU * , WordSet  , UWord  ) ;
3933 extern WordSet vgHelgrind_unionWS(WordSetU * , WordSet  , WordSet  ) ;   3933 extern WordSet vgHelgrind_unionWS(WordSetU * , WordSet  , WordSet  ) ;
3934 extern WordSet vgHelgrind_intersectWS(WordSetU * , WordSet  , WordSet  ) ;   3934 extern WordSet vgHelgrind_intersectWS(WordSetU * , WordSet  , WordSet  ) ;
3935 extern WordSet vgHelgrind_minusWS(WordSetU * , WordSet  , WordSet  ) ;   3935 extern WordSet vgHelgrind_minusWS(WordSetU * , WordSet  , WordSet  ) ;
3936 extern Bool vgHelgrind_isEmptyWS(WordSetU * , WordSet  ) ;   3936 extern Bool vgHelgrind_isEmptyWS(WordSetU * , WordSet  ) ;
3937 extern Bool vgHelgrind_isSingletonWS(WordSetU * , WordSet  , UWord  ) ;   3937 extern Bool vgHelgrind_isSingletonWS(WordSetU * , WordSet  , UWord  ) ;
3938 extern UWord vgHelgrind_anyElementOfWS(WordSetU * , WordSet  ) ;   3938 extern UWord vgHelgrind_anyElementOfWS(WordSetU * , WordSet  ) ;
3939 extern UWord vgHelgrind_cardinalityWS(WordSetU * , WordSet  ) ;   3939 extern UWord vgHelgrind_cardinalityWS(WordSetU * , WordSet  ) ;
3940 extern Bool vgHelgrind_elemWS(WordSetU * , WordSet  , UWord  ) ;   3940 extern Bool vgHelgrind_elemWS(WordSetU * , WordSet  , UWord  ) ;
3941 extern WordSet vgHelgrind_doubletonWS(WordSetU * , UWord  , UWord  ) ;   3941 extern WordSet vgHelgrind_doubletonWS(WordSetU * , UWord  , UWord  ) ;
3942 extern WordSet vgHelgrind_singletonWS(WordSetU * , UWord  ) ;   3942 extern WordSet vgHelgrind_singletonWS(WordSetU * , UWord  ) ;
3943 extern WordSet vgHelgrind_isSubsetOf(WordSetU * , WordSet  , WordSet  ) ;   3943 extern WordSet vgHelgrind_isSubsetOf(WordSetU * , WordSet  , WordSet  ) ;
3944 extern Bool vgHelgrind_plausibleWS(WordSetU * , WordSet  ) ;   3944 extern Bool vgHelgrind_plausibleWS(WordSetU * , WordSet  ) ;
3945 extern Bool vgHelgrind_saneWS_SLOW(WordSetU * , WordSet  ) ;   3945 extern Bool vgHelgrind_saneWS_SLOW(WordSetU * , WordSet  ) ;
3946 extern void vgHelgrind_ppWS(WordSetU * , WordSet  ) ;   3946 extern void vgHelgrind_ppWS(WordSetU * , WordSet  ) ;
3947 extern void vgHelgrind_getPayloadWS(UWord **words , UWord *nWords , WordSetU * ,   3947 extern void vgHelgrind_getPayloadWS(UWord **words , UWord *nWords , WordSetU * ,
3948                                     WordSet  ) ;   3948                                     WordSet  ) ;
3949 extern Bool vgHelgrind_is_sane_Thread(Thread *thr ) ;   3949 extern Bool vgHelgrind_is_sane_Thread(Thread *thr ) ;
3950 extern Bool vgHelgrind_is_sane_LockP(Lock *lock ) ;   3950 extern Bool vgHelgrind_is_sane_LockP(Lock *lock ) ;
3951 extern Bool vgHelgrind_is_sane_LockN(Lock *lock ) ;   3951 extern Bool vgHelgrind_is_sane_LockN(Lock *lock ) ;
3952 extern Bool vgHelgrind_is_sane_LockNorP(Lock *lock ) ;   3952 extern Bool vgHelgrind_is_sane_LockNorP(Lock *lock ) ;
3953 extern Bool vgHelgrind_eq_Error(VgRes not_used , Error *e1 , Error *e2 ) ;   3953 extern Bool vgHelgrind_eq_Error(VgRes not_used , Error *e1 , Error *e2 ) ;
3954 extern void vgHelgrind_before_pp_Error(Error *err ) ;   3954 extern void vgHelgrind_before_pp_Error(Error *err ) ;
3955 extern void vgHelgrind_pp_Error(Error *err ) ;   3955 extern void vgHelgrind_pp_Error(Error *err ) ;
3956 extern UInt vgHelgrind_update_extra(Error *err ) ;   3956 extern UInt vgHelgrind_update_extra(Error *err ) ;
3957 extern Bool vgHelgrind_recognised_suppression(Char *name , Supp *su ) ;   3957 extern Bool vgHelgrind_recognised_suppression(Char *name , Supp *su ) ;
3958 extern Bool vgHelgrind_read_extra_suppression_info(Int fd , Char **bufpp ,   3958 extern Bool vgHelgrind_read_extra_suppression_info(Int fd , Char **bufpp ,
3959                                                    SizeT *nBufp , Supp *su ) ;   3959                                                    SizeT *nBufp , Supp *su ) ;
3960 extern Bool vgHelgrind_error_matches_suppression(Error *err , Supp *su ) ;   3960 extern Bool vgHelgrind_error_matches_suppression(Error *err , Supp *su ) ;
3961 extern Char *vgHelgrind_get_error_name(Error *err ) ;   3961 extern Char *vgHelgrind_get_error_name(Error *err ) ;
3962 extern Bool vgHelgrind_get_extra_suppression_info(Error *err , Char *buf ,   3962 extern Bool vgHelgrind_get_extra_suppression_info(Error *err , Char *buf ,
3963                                                   Int nBuf ) ;   3963                                                   Int nBuf ) ;
3964 extern void vgHelgrind_record_error_Race(Thread *thr , Addr data_addr ,   3964 extern void vgHelgrind_record_error_Race(Thread *thr , Addr data_addr ,
3965                                          Int szB , Bool isWrite ,   3965                                          Int szB , Bool isWrite ,
3966                                          Thread *h1_confthr ,   3966                                          Thread *h1_confthr ,
3967                                          ExeContext *h1_ct_segstart ,   3967                                          ExeContext *h1_ct_segstart ,
3968                                          ExeContext *h1_ct_mbsegend ) ;   3968                                          ExeContext *h1_ct_mbsegend ) ;
3969 extern void vgHelgrind_record_error_UnlockUnlocked(Thread * , Lock * ) ;   3969 extern void vgHelgrind_record_error_UnlockUnlocked(Thread * , Lock * ) ;
3970 extern void vgHelgrind_record_error_UnlockForeign(Thread * , Thread * , Lock * ) ;   3970 extern void vgHelgrind_record_error_UnlockForeign(Thread * , Thread * , Lock * ) ;
3971 extern void vgHelgrind_record_error_UnlockBogus(Thread * , Addr  ) ;   3971 extern void vgHelgrind_record_error_UnlockBogus(Thread * , Addr  ) ;
3972 extern void vgHelgrind_record_error_PthAPIerror(Thread * , HChar * , Word  ,   3972 extern void vgHelgrind_record_error_PthAPIerror(Thread * , HChar * , Word  ,
3973                                                 HChar * ) ;   3973                                                 HChar * ) ;
3974 extern void vgHelgrind_record_error_LockOrder(Thread * , Addr  , Addr  ,   3974 extern void vgHelgrind_record_error_LockOrder(Thread * , Addr  , Addr  ,
3975                                               ExeContext * , ExeContext * ) ;   3975                                               ExeContext * , ExeContext * ) ;
3976 extern void vgHelgrind_record_error_Misc_w_aux(Thread * , HChar *errstr ,   3976 extern void vgHelgrind_record_error_Misc_w_aux(Thread * , HChar *errstr ,
3977                                                HChar *auxstr ,   3977                                                HChar *auxstr ,
3978                                                ExeContext *auxctx ) ;   3978                                                ExeContext *auxctx ) ;
3979 extern void vgHelgrind_record_error_Misc(Thread *thr , HChar *errstr ) ;   3979 extern void vgHelgrind_record_error_Misc(Thread *thr , HChar *errstr ) ;
3980 extern ULong vgHelgrind_stats__LockN_to_P_queries ;   3980 extern ULong vgHelgrind_stats__LockN_to_P_queries ;
3981 extern ULong vgHelgrind_stats__LockN_to_P_get_map_size(void) ;   3981 extern ULong vgHelgrind_stats__LockN_to_P_get_map_size(void) ;
3982 extern ULong vgHelgrind_stats__string_table_queries ;   3982 extern ULong vgHelgrind_stats__string_table_queries ;
3983 extern ULong vgHelgrind_stats__string_table_get_map_size(void) ;   3983 extern ULong vgHelgrind_stats__string_table_get_map_size(void) ;
3984 Bool vgHelgrind_mm_find_containing_block(ExeContext **where , Addr *payload ,   3984 Bool vgHelgrind_mm_find_containing_block(ExeContext **where , Addr *payload ,
3985                                          SizeT *szB , Addr data_addr ) ;   3985                                          SizeT *szB , Addr data_addr ) ;
3986 extern Thr *libhb_init(void (*get_stacktrace)(Thr * , Addr * , UWord  ) ,   3986 extern Thr *libhb_init(void (*get_stacktrace)(Thr * , Addr * , UWord  ) ,
3987                        ExeContext *(*get_EC)(Thr * ) ) ;   3987                        ExeContext *(*get_EC)(Thr * ) ) ;
3988 extern void libhb_shutdown(Bool show_stats ) ;   3988 extern void libhb_shutdown(Bool show_stats ) ;
3989 extern Thr *libhb_create(Thr *parent ) ;   3989 extern Thr *libhb_create(Thr *parent ) ;
3990 extern void libhb_async_exit(Thr *exitter ) ;   3990 extern void libhb_async_exit(Thr *exitter ) ;
3991 extern SO *libhb_so_alloc(void) ;   3991 extern SO *libhb_so_alloc(void) ;
3992 extern void libhb_so_dealloc(SO *so ) ;   3992 extern void libhb_so_dealloc(SO *so ) ;
3993 extern void libhb_so_send(Thr *thr , SO *so , Bool strong_send ) ;   3993 extern void libhb_so_send(Thr *thr , SO *so , Bool strong_send ) ;
3994 extern void libhb_so_recv(Thr *thr , SO *so , Bool strong_recv ) ;   3994 extern void libhb_so_recv(Thr *thr , SO *so , Bool strong_recv ) ;
3995 extern Bool libhb_so_everSent(SO *so ) ;   3995 extern Bool libhb_so_everSent(SO *so ) ;
3996 extern void zsm_sapply08_f__msmcwrite(Thr *thr , Addr a ) ;   3996 extern void zsm_sapply08_f__msmcwrite(Thr *thr , Addr a ) ;
3997 extern void zsm_sapply16_f__msmcwrite(Thr *thr , Addr a ) ;   3997 extern void zsm_sapply16_f__msmcwrite(Thr *thr , Addr a ) ;
3998 extern void zsm_sapply32_f__msmcwrite(Thr *thr , Addr a ) ;   3998 extern void zsm_sapply32_f__msmcwrite(Thr *thr , Addr a ) ;
3999 extern void zsm_sapply64_f__msmcwrite(Thr *thr , Addr a ) ;   3999 extern void zsm_sapply64_f__msmcwrite(Thr *thr , Addr a ) ;
4000 extern void zsm_sapplyNN_f__msmcwrite(Thr *thr , Addr a , SizeT len ) ;   4000 extern void zsm_sapplyNN_f__msmcwrite(Thr *thr , Addr a , SizeT len ) ;
4001 extern void zsm_sapply08_f__msmcread(Thr *thr , Addr a ) ;   4001 extern void zsm_sapply08_f__msmcread(Thr *thr , Addr a ) ;
4002 extern void zsm_sapply16_f__msmcread(Thr *thr , Addr a ) ;   4002 extern void zsm_sapply16_f__msmcread(Thr *thr , Addr a ) ;
4003 extern void zsm_sapply32_f__msmcread(Thr *thr , Addr a ) ;   4003 extern void zsm_sapply32_f__msmcread(Thr *thr , Addr a ) ;
4004 extern void zsm_sapply64_f__msmcread(Thr *thr , Addr a ) ;   4004 extern void zsm_sapply64_f__msmcread(Thr *thr , Addr a ) ;
4005 extern void zsm_sapplyNN_f__msmcread(Thr *thr , Addr a , SizeT len ) ;   4005 extern void zsm_sapplyNN_f__msmcread(Thr *thr , Addr a , SizeT len ) ;
4006 extern void libhb_Thr_resumes(Thr *thr ) ;   4006 extern void libhb_Thr_resumes(Thr *thr ) ;
4007 extern void libhb_srange_new(Thr * , Addr  , SizeT  ) ;   4007 extern void libhb_srange_new(Thr * , Addr  , SizeT  ) ;
4008 extern void libhb_srange_noaccess(Thr * , Addr  , SizeT  ) ;   4008 extern void libhb_srange_noaccess(Thr * , Addr  , SizeT  ) ;
4009 extern void libhb_srange_untrack(Thr * , Addr  , SizeT  ) ;   4009 extern void libhb_srange_untrack(Thr * , Addr  , SizeT  ) ;
4010 extern Thread *libhb_get_Thr_hgthread(Thr * ) ;   4010 extern Thread *libhb_get_Thr_hgthread(Thr * ) ;
4011 extern void libhb_set_Thr_hgthread(Thr * , Thread * ) ;   4011 extern void libhb_set_Thr_hgthread(Thr * , Thread * ) ;
4012 extern void libhb_copy_shadow_state(Thr *thr , Addr src , Addr dst , SizeT len ) ;   4012 extern void libhb_copy_shadow_state(Thr *thr , Addr src , Addr dst , SizeT len ) ;
4013 extern void libhb_maybe_GC(void) ;   4013 extern void libhb_maybe_GC(void) ;
4014 extern Bool libhb_event_map_lookup(ExeContext **resEC , Thr **resThr ,   4014 extern Bool libhb_event_map_lookup(ExeContext **resEC , Thr **resThr ,
4015                                    SizeT *resSzB , Bool *resIsW , Thr *thr ,   4015                                    SizeT *resSzB , Bool *resIsW , Thr *thr ,
4016                                    Addr a , SizeT szB , Bool isW ) ;   4016                                    Addr a , SizeT szB , Bool isW ) ;
4017 static int ( /* format attribute */  VALGRIND_PRINTF)(char const   *format   4017 static int ( /* format attribute */  VALGRIND_PRINTF)(char const   *format
4018                                                       , ...)  __attribute__((__unused__)) ;   4018                                                       , ...)  __attribute__((__unused__)) ;
4019 static int ( /* format attribute */  VALGRIND_PRINTF)(char const   *format   4019 static int ( /* format attribute */  VALGRIND_PRINTF)(char const   *format
4020                                                       , ...)  __attribute__((__unused__)) ;   4020                                                       , ...)  __attribute__((__unused__)) ;
4021 static int ( /* format attribute */  VALGRIND_PRINTF)(char const   *format   4021 static int ( /* format attribute */  VALGRIND_PRINTF)(char const   *format
4022                                                       , ...)   4022                                                       , ...)
4023 {   4023 {
4024   unsigned long _qzz_res ;   4024   unsigned long _qzz_res ;
4025   va_list vargs ;   4025   va_list vargs ;
4026   unsigned int volatile   _zzq_args[6] ;   4026   unsigned int volatile   _zzq_args[6] ;
4027   unsigned int volatile   _zzq_result ;   4027   unsigned int volatile   _zzq_result ;
4028     4028  
4029   {   4029   {
4030   __builtin_va_start(vargs, format);   4030   __builtin_va_start(vargs, format);
4031   _zzq_args[0] = (unsigned int volatile   )5123U;   4031   _zzq_args[0] = (unsigned int volatile   )5123U;
4032   _zzq_args[1] = (unsigned int volatile   )((unsigned int )((unsigned long )format));   4032   _zzq_args[1] = (unsigned int volatile   )((unsigned int )((unsigned long )format));
4033   _zzq_args[2] = (unsigned int volatile   )((unsigned int )((unsigned long )(& vargs)));   4033   _zzq_args[2] = (unsigned int volatile   )((unsigned int )((unsigned long )(& vargs)));
4034   _zzq_args[3] = (unsigned int volatile   )0U;   4034   _zzq_args[3] = (unsigned int volatile   )0U;
4035   _zzq_args[4] = (unsigned int volatile   )0U;   4035   _zzq_args[4] = (unsigned int volatile   )0U;
4036   _zzq_args[5] = (unsigned int volatile   )0U;   4036   _zzq_args[5] = (unsigned int volatile   )0U;
4037   __asm__  volatile   ("roll $3,  %%edi ; roll $13, %%edi\n\t"   4037   __asm__  volatile   ("roll $3,  %%edi ; roll $13, %%edi\n\t"
4038                        "roll $29, %%edi ; roll $19, %%edi\n\t"   4038                        "roll $29, %%edi ; roll $19, %%edi\n\t"
4039                        "xchgl %%ebx,%%ebx": "=d" (_zzq_result): "a" (& _zzq_args[0]),   4039                        "xchgl %%ebx,%%ebx": "=d" (_zzq_result): "a" (& _zzq_args[0]),
4040                        "0" (0): "cc", "memory");   4040                        "0" (0): "cc", "memory");
4041   _qzz_res = (unsigned long )_zzq_result;   4041   _qzz_res = (unsigned long )_zzq_result;
4042   __builtin_va_end(vargs);   4042   __builtin_va_end(vargs);
4043   return ((int )_qzz_res);   4043   return ((int )_qzz_res);
4044 }   4044 }
4045 }   4045 }
4046 static int ( /* format attribute */  VALGRIND_PRINTF_BACKTRACE)(char const   *format   4046 static int ( /* format attribute */  VALGRIND_PRINTF_BACKTRACE)(char const   *format
4047                                                                 , ...)  __attribute__((__unused__)) ;   4047                                                                 , ...)  __attribute__((__unused__)) ;
4048 static int ( /* format attribute */  VALGRIND_PRINTF_BACKTRACE)(char const   *format   4048 static int ( /* format attribute */  VALGRIND_PRINTF_BACKTRACE)(char const   *format
4049                                                                 , ...)  __attribute__((__unused__)) ;   4049                                                                 , ...)  __attribute__((__unused__)) ;
4050 static int ( /* format attribute */  VALGRIND_PRINTF_BACKTRACE)(char const   *format   4050 static int ( /* format attribute */  VALGRIND_PRINTF_BACKTRACE)(char const   *format
4051                                                                 , ...)   4051                                                                 , ...)
4052 {   4052 {
4053   unsigned long _qzz_res ;   4053   unsigned long _qzz_res ;
4054   va_list vargs ;   4054   va_list vargs ;
4055   unsigned int volatile   _zzq_args[6] ;   4055   unsigned int volatile   _zzq_args[6] ;
4056   unsigned int volatile   _zzq_result ;   4056   unsigned int volatile   _zzq_result ;
4057     4057  
4058   {   4058   {
4059   __builtin_va_start(vargs, format);   4059   __builtin_va_start(vargs, format);
4060   _zzq_args[0] = (unsigned int volatile   )5124U;   4060   _zzq_args[0] = (unsigned int volatile   )5124U;
4061   _zzq_args[1] = (unsigned int volatile   )((unsigned int )((unsigned long )format));   4061   _zzq_args[1] = (unsigned int volatile   )((unsigned int )((unsigned long )format));
4062   _zzq_args[2] = (unsigned int volatile   )((unsigned int )((unsigned long )(& vargs)));   4062   _zzq_args[2] = (unsigned int volatile   )((unsigned int )((unsigned long )(& vargs)));
4063   _zzq_args[3] = (unsigned int volatile   )0U;   4063   _zzq_args[3] = (unsigned int volatile   )0U;
4064   _zzq_args[4] = (unsigned int volatile   )0U;   4064   _zzq_args[4] = (unsigned int volatile   )0U;
4065   _zzq_args[5] = (unsigned int volatile   )0U;   4065   _zzq_args[5] = (unsigned int volatile   )0U;
4066   __asm__  volatile   ("roll $3,  %%edi ; roll $13, %%edi\n\t"   4066   __asm__  volatile   ("roll $3,  %%edi ; roll $13, %%edi\n\t"
4067                        "roll $29, %%edi ; roll $19, %%edi\n\t"   4067                        "roll $29, %%edi ; roll $19, %%edi\n\t"
4068                        "xchgl %%ebx,%%ebx": "=d" (_zzq_result): "a" (& _zzq_args[0]),   4068                        "xchgl %%ebx,%%ebx": "=d" (_zzq_result): "a" (& _zzq_args[0]),
4069                        "0" (0): "cc", "memory");   4069                        "0" (0): "cc", "memory");
4070   _qzz_res = (unsigned long )_zzq_result;   4070   _qzz_res = (unsigned long )_zzq_result;
4071   __builtin_va_end(vargs);   4071   __builtin_va_end(vargs);
4072   return ((int )_qzz_res);   4072   return ((int )_qzz_res);
4073 }   4073 }
4074 }   4074 }
4075 static void all__sanity_check(Char *who ) ;   4075 static void all__sanity_check(Char *who ) ;
4076 static Thread *admin_threads  =    (Thread *)((void *)0);   4076 static Thread *admin_threads  =    (Thread *)((void *)0);
4077 static Lock *admin_locks  =    (Lock *)((void *)0);   4077 static Lock *admin_locks  =    (Lock *)((void *)0);
4078 static Thread **map_threads  =    (Thread **)((void *)0);   4078 static Thread **map_threads  =    (Thread **)((void *)0);
4079 static WordFM *map_locks  =    (WordFM *)((void *)0);   4079 static WordFM *map_locks  =    (WordFM *)((void *)0);
4080 static WordSetU *univ_lsets  =    (WordSetU *)((void *)0);   4080 static WordSetU *univ_lsets  =    (WordSetU *)((void *)0);
4081 static WordSetU *univ_laog  =    (WordSetU *)((void *)0);   4081 static WordSetU *univ_laog  =    (WordSetU *)((void *)0);
4082 static UWord stats__lockN_acquires  =    (UWord )0;   4082 static UWord stats__lockN_acquires  =    (UWord )0;
4083 static UWord stats__lockN_releases  =    (UWord )0;   4083 static UWord stats__lockN_releases  =    (UWord )0;
4084 static ThreadId map_threads_maybe_reverse_lookup_SLOW(Thread *thr ) ;   4084 static ThreadId map_threads_maybe_reverse_lookup_SLOW(Thread *thr ) ;
4085 static Thread *mk_Thread(Thr *hbthr ) ;   4085 static Thread *mk_Thread(Thr *hbthr ) ;
4086 static Int indx  =    1;   4086 static Int indx  =    1;
4087 static Thread *mk_Thread(Thr *hbthr )   4087 static Thread *mk_Thread(Thr *hbthr )
4088 {   4088 {
4089   Thread *thread ;   4089   Thread *thread ;
4090   void *tmp ;   4090   void *tmp ;
4091   Int tmp___0 ;   4091   Int tmp___0 ;
4092     4092  
4093   {   4093   {
4094   tmp = vgHelgrind_zalloc((HChar *)"hg.mk_Thread.1", (SizeT )sizeof(Thread ));   4094   tmp = vgHelgrind_zalloc((HChar *)"hg.mk_Thread.1", (SizeT )sizeof(Thread ));
4095   thread = (Thread *)tmp;   4095   thread = (Thread *)tmp;
4096   thread->locksetA = vgHelgrind_emptyWS(univ_lsets);   4096   thread->locksetA = vgHelgrind_emptyWS(univ_lsets);
4097   thread->locksetW = vgHelgrind_emptyWS(univ_lsets);   4097   thread->locksetW = vgHelgrind_emptyWS(univ_lsets);
4098   thread->magic = (UInt )1347405285;   4098   thread->magic = (UInt )1347405285;
4099   thread->hbthr = hbthr;   4099   thread->hbthr = hbthr;
4100   thread->coretid = (ThreadId )0;   4100   thread->coretid = (ThreadId )0;
4101   thread->created_at = (ExeContext *)((void *)0);   4101   thread->created_at = (ExeContext *)((void *)0);
4102   thread->announced = (Bool )0;   4102   thread->announced = (Bool )0;
4103   tmp___0 = indx;   4103   tmp___0 = indx;
4104   indx ++;   4104   indx ++;
4105   thread->errmsg_index = tmp___0;   4105   thread->errmsg_index = tmp___0;
4106   thread->admin = admin_threads;   4106   thread->admin = admin_threads;
4107   admin_threads = thread;   4107   admin_threads = thread;
4108   return (thread);   4108   return (thread);
4109 }   4109 }
4110 }   4110 }
4111 static Lock *mk_LockN(LockKind kind , Addr guestaddr ) ;   4111 static Lock *mk_LockN(LockKind kind , Addr guestaddr ) ;
4112 static ULong unique  =    (ULong )0;   4112 static ULong unique  =    (ULong )0;
4113 static Lock *mk_LockN(LockKind kind , Addr guestaddr )   4113 static Lock *mk_LockN(LockKind kind , Addr guestaddr )
4114 {   4114 {
4115   Lock *lock ;   4115   Lock *lock ;
4116   void *tmp ;   4116   void *tmp ;
4117   ULong tmp___0 ;   4117   ULong tmp___0 ;
4118   Bool tmp___1 ;   4118   Bool tmp___1 ;
4119     4119  
4120   {   4120   {
4121   tmp = vgHelgrind_zalloc((HChar *)"hg.mk_Lock.1", (SizeT )sizeof(Lock ));   4121   tmp = vgHelgrind_zalloc((HChar *)"hg.mk_Lock.1", (SizeT )sizeof(Lock ));
4122   lock = (Lock *)tmp;   4122   lock = (Lock *)tmp;
4123   if (admin_locks) {   4123   if (admin_locks) {
4124     admin_locks->admin_prev = lock;   4124     admin_locks->admin_prev = lock;
4125   } else {   4125   } else {
4126     4126  
4127   }   4127   }
4128   lock->admin_next = admin_locks;   4128   lock->admin_next = admin_locks;
4129   lock->admin_prev = (struct _Lock *)((void *)0);   4129   lock->admin_prev = (struct _Lock *)((void *)0);
4130   admin_locks = lock;   4130   admin_locks = lock;
4131   tmp___0 = unique;   4131   tmp___0 = unique;
4132   unique ++;   4132   unique ++;
4133   lock->unique = tmp___0;   4133   lock->unique = tmp___0;
4134   lock->magic = (UInt )1699067223;   4134   lock->magic = (UInt )1699067223;
4135   lock->appeared_at = (ExeContext *)((void *)0);   4135   lock->appeared_at = (ExeContext *)((void *)0);
4136   lock->acquired_at = (ExeContext *)((void *)0);   4136   lock->acquired_at = (ExeContext *)((void *)0);
4137   lock->hbso = libhb_so_alloc();   4137   lock->hbso = libhb_so_alloc();
4138   lock->guestaddr = guestaddr;   4138   lock->guestaddr = guestaddr;
4139   lock->kind = kind;   4139   lock->kind = kind;
4140   lock->heldW = (Bool )0;   4140   lock->heldW = (Bool )0;
4141   lock->heldBy = (WordBag *)((void *)0);   4141   lock->heldBy = (WordBag *)((void *)0);
4142   tmp___1 = vgHelgrind_is_sane_LockN(lock);   4142   tmp___1 = vgHelgrind_is_sane_LockN(lock);
4143   if (tmp___1) {   4143   if (tmp___1) {
4144     4144  
4145   } else {   4145   } else {
4146     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lock)",   4146     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lock)",
4147                         (Char const   *)"hg_main.c", 189,   4147                         (Char const   *)"hg_main.c", 189,
4148                         (Char const   *)"mk_LockN", "");   4148                         (Char const   *)"mk_LockN", "");
4149   }   4149   }
4150   return (lock);   4150   return (lock);
4151 }   4151 }
4152 }   4152 }
4153 static void del_LockN(Lock *lk )   4153 static void del_LockN(Lock *lk )
4154 {   4154 {
4155   Bool tmp ;   4155   Bool tmp ;
4156     4156  
4157   {   4157   {
4158   tmp = vgHelgrind_is_sane_LockN(lk);   4158   tmp = vgHelgrind_is_sane_LockN(lk);
4159   if (tmp) {   4159   if (tmp) {
4160     4160  
4161   } else {   4161   } else {
4162     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   4162     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
4163                         (Char const   *)"hg_main.c", 197,   4163                         (Char const   *)"hg_main.c", 197,
4164                         (Char const   *)"del_LockN", "");   4164                         (Char const   *)"del_LockN", "");
4165   }   4165   }
4166   if (lk->hbso) {   4166   if (lk->hbso) {
4167     4167  
4168   } else {   4168   } else {
4169     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->hbso",   4169     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->hbso",
4170                         (Char const   *)"hg_main.c", 198,   4170                         (Char const   *)"hg_main.c", 198,
4171                         (Char const   *)"del_LockN", "");   4171                         (Char const   *)"del_LockN", "");
4172   }   4172   }
4173   libhb_so_dealloc(lk->hbso);   4173   libhb_so_dealloc(lk->hbso);
4174   if (lk->heldBy) {   4174   if (lk->heldBy) {
4175     vgPlain_deleteBag(lk->heldBy);   4175     vgPlain_deleteBag(lk->heldBy);
4176   } else {   4176   } else {
4177     4177  
4178   }   4178   }
4179   if ((unsigned int )lk == (unsigned int )admin_locks) {   4179   if ((unsigned int )lk == (unsigned int )admin_locks) {
4180     if ((unsigned int )lk->admin_prev == (unsigned int )((void *)0)) {   4180     if ((unsigned int )lk->admin_prev == (unsigned int )((void *)0)) {
4181     4181  
4182     } else {   4182     } else {
4183       vgPlain_assert_fail((Bool )0, (Char const   *)"lk->admin_prev == NULL",   4183       vgPlain_assert_fail((Bool )0, (Char const   *)"lk->admin_prev == NULL",
4184                           (Char const   *)"hg_main.c", 204,   4184                           (Char const   *)"hg_main.c", 204,
4185                           (Char const   *)"del_LockN", "");   4185                           (Char const   *)"del_LockN", "");
4186     }   4186     }
4187     if (lk->admin_next) {   4187     if (lk->admin_next) {
4188       (lk->admin_next)->admin_prev = (struct _Lock *)((void *)0);   4188       (lk->admin_next)->admin_prev = (struct _Lock *)((void *)0);
4189     } else {   4189     } else {
4190     4190  
4191     }   4191     }
4192     admin_locks = lk->admin_next;   4192     admin_locks = lk->admin_next;
4193   } else {   4193   } else {
4194     if ((unsigned int )lk->admin_prev != (unsigned int )((void *)0)) {   4194     if ((unsigned int )lk->admin_prev != (unsigned int )((void *)0)) {
4195     4195  
4196     } else {   4196     } else {
4197       vgPlain_assert_fail((Bool )0, (Char const   *)"lk->admin_prev != NULL",   4197       vgPlain_assert_fail((Bool )0, (Char const   *)"lk->admin_prev != NULL",
4198                           (Char const   *)"hg_main.c", 210,   4198                           (Char const   *)"hg_main.c", 210,
4199                           (Char const   *)"del_LockN", "");   4199                           (Char const   *)"del_LockN", "");
4200     }   4200     }
4201     (lk->admin_prev)->admin_next = lk->admin_next;   4201     (lk->admin_prev)->admin_next = lk->admin_next;
4202     if (lk->admin_next) {   4202     if (lk->admin_next) {
4203       (lk->admin_next)->admin_prev = lk->admin_prev;   4203       (lk->admin_next)->admin_prev = lk->admin_prev;
4204     } else {   4204     } else {
4205     4205  
4206     }   4206     }
4207   }   4207   }
4208   vgPlain_memset((void *)lk, 170, (SizeT )sizeof(*lk));   4208   vgPlain_memset((void *)lk, 170, (SizeT )sizeof(*lk));
4209   vgHelgrind_free((void *)lk);   4209   vgHelgrind_free((void *)lk);
4210   return;   4210   return;
4211 }   4211 }
4212 }   4212 }
4213 static void lockN_acquire_writer(Lock *lk , Thread *thr )   4213 static void lockN_acquire_writer(Lock *lk , Thread *thr )
4214 {   4214 {
4215   Bool tmp ;   4215   Bool tmp ;
4216   Bool tmp___0 ;   4216   Bool tmp___0 ;
4217   ThreadId tid ;   4217   ThreadId tid ;
4218   UWord tmp___1 ;   4218   UWord tmp___1 ;
4219   UWord tmp___2 ;   4219   UWord tmp___2 ;
4220   UWord tmp___3 ;   4220   UWord tmp___3 ;
4221   Bool tmp___4 ;   4221   Bool tmp___4 ;
4222     4222  
4223   {   4223   {
4224   tmp = vgHelgrind_is_sane_LockN(lk);   4224   tmp = vgHelgrind_is_sane_LockN(lk);
4225   if (tmp) {   4225   if (tmp) {
4226     4226  
4227   } else {   4227   } else {
4228     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   4228     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
4229                         (Char const   *)"hg_main.c", 225,   4229                         (Char const   *)"hg_main.c", 225,
4230                         (Char const   *)"lockN_acquire_writer", "");   4230                         (Char const   *)"lockN_acquire_writer", "");
4231   }   4231   }
4232   tmp___0 = vgHelgrind_is_sane_Thread(thr);   4232   tmp___0 = vgHelgrind_is_sane_Thread(thr);
4233   if (tmp___0) {   4233   if (tmp___0) {
4234     4234  
4235   } else {   4235   } else {
4236     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",   4236     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",
4237                         (Char const   *)"hg_main.c", 226,   4237                         (Char const   *)"hg_main.c", 226,
4238                         (Char const   *)"lockN_acquire_writer", "");   4238                         (Char const   *)"lockN_acquire_writer", "");
4239   }   4239   }
4240   stats__lockN_acquires ++;   4240   stats__lockN_acquires ++;
4241   if ((unsigned int )lk->acquired_at == (unsigned int )((void *)0)) {   4241   if ((unsigned int )lk->acquired_at == (unsigned int )((void *)0)) {
4242     if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {   4242     if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {
4243     4243  
4244     } else {   4244     } else {
4245       vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy == NULL",   4245       vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy == NULL",
4246                           (Char const   *)"hg_main.c", 235,   4246                           (Char const   *)"hg_main.c", 235,
4247                           (Char const   *)"lockN_acquire_writer", "");   4247                           (Char const   *)"lockN_acquire_writer", "");
4248     }   4248     }
4249     tid = map_threads_maybe_reverse_lookup_SLOW(thr);   4249     tid = map_threads_maybe_reverse_lookup_SLOW(thr);
4250     lk->acquired_at = vgPlain_record_ExeContext(tid, (Word )0);   4250     lk->acquired_at = vgPlain_record_ExeContext(tid, (Word )0);
4251   } else   4251   } else
4252   if ((unsigned int )lk->heldBy != (unsigned int )((void *)0)) {   4252   if ((unsigned int )lk->heldBy != (unsigned int )((void *)0)) {
4253     4253  
4254   } else {   4254   } else {
4255     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy != NULL",   4255     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy != NULL",
4256                         (Char const   *)"hg_main.c", 240,   4256                         (Char const   *)"hg_main.c", 240,
4257                         (Char const   *)"lockN_acquire_writer", "");   4257                         (Char const   *)"lockN_acquire_writer", "");
4258   }   4258   }
4259   switch ((unsigned int )lk->kind) {   4259   switch ((unsigned int )lk->kind) {
4260   case_LK_nonRec:   4260   case_LK_nonRec:
4261   case 1002U:   4261   case 1002U:
4262   if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {   4262   if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {
4263     4263  
4264   } else {   4264   } else {
4265     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy == NULL",   4265     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy == NULL",
4266                         (Char const   *)"hg_main.c", 247,   4266                         (Char const   *)"hg_main.c", 247,
4267                         (Char const   *)"lockN_acquire_writer", "");   4267                         (Char const   *)"lockN_acquire_writer", "");
4268   }   4268   }
4269   if (! lk->heldW) {   4269   if (! lk->heldW) {
4270     4270  
4271   } else {   4271   } else {
4272     vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldW",   4272     vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldW",
4273                         (Char const   *)"hg_main.c", 248,   4273                         (Char const   *)"hg_main.c", 248,
4274                         (Char const   *)"lockN_acquire_writer", "");   4274                         (Char const   *)"lockN_acquire_writer", "");
4275   }   4275   }
4276   lk->heldW = (Bool )1;   4276   lk->heldW = (Bool )1;
4277   lk->heldBy = vgPlain_newBag(& vgHelgrind_zalloc, (HChar *)"hg.lNaw.1",   4277   lk->heldBy = vgPlain_newBag(& vgHelgrind_zalloc, (HChar *)"hg.lNaw.1",
4278                               & vgHelgrind_free);   4278                               & vgHelgrind_free);
4279   vgPlain_addToBag(lk->heldBy, (UWord )((Word )thr));   4279   vgPlain_addToBag(lk->heldBy, (UWord )((Word )thr));
4280   break;   4280   break;
4281   case 1001U:   4281   case 1001U:
4282   if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {   4282   if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {
4283     goto case_LK_nonRec;   4283     goto case_LK_nonRec;
4284   } else {   4284   } else {
4285     4285  
4286   }   4286   }
4287   if (lk->heldW) {   4287   if (lk->heldW) {
4288     4288  
4289   } else {   4289   } else {
4290     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldW",   4290     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldW",
4291                         (Char const   *)"hg_main.c", 257,   4291                         (Char const   *)"hg_main.c", 257,
4292                         (Char const   *)"lockN_acquire_writer", "");   4292                         (Char const   *)"lockN_acquire_writer", "");
4293   }   4293   }
4294   tmp___1 = vgPlain_sizeUniqueBag(lk->heldBy);   4294   tmp___1 = vgPlain_sizeUniqueBag(lk->heldBy);
4295   if (tmp___1 == 1UL) {   4295   if (tmp___1 == 1UL) {
4296     4296  
4297   } else {   4297   } else {
4298     vgPlain_assert_fail((Bool )0,   4298     vgPlain_assert_fail((Bool )0,
4299                         (Char const   *)"VG_(sizeUniqueBag(lk->heldBy)) == 1",   4299                         (Char const   *)"VG_(sizeUniqueBag(lk->heldBy)) == 1",
4300                         (Char const   *)"hg_main.c", 259,   4300                         (Char const   *)"hg_main.c", 259,
4301                         (Char const   *)"lockN_acquire_writer", "");   4301                         (Char const   *)"lockN_acquire_writer", "");
4302   }   4302   }
4303   tmp___2 = vgPlain_elemBag(lk->heldBy, (UWord )((Word )thr));   4303   tmp___2 = vgPlain_elemBag(lk->heldBy, (UWord )((Word )thr));
4304   tmp___3 = vgPlain_sizeTotalBag(lk->heldBy);   4304   tmp___3 = vgPlain_sizeTotalBag(lk->heldBy);
4305   if (tmp___2 == tmp___3) {   4305   if (tmp___2 == tmp___3) {
4306     4306  
4307   } else {   4307   } else {
4308     vgPlain_assert_fail((Bool )0,   4308     vgPlain_assert_fail((Bool )0,
4309                         (Char const   *)"VG_(elemBag)(lk->heldBy, (Word)thr) == VG_(sizeTotalBag)(lk->heldBy)",   4309                         (Char const   *)"VG_(elemBag)(lk->heldBy, (Word)thr) == VG_(sizeTotalBag)(lk->heldBy)",
4310                         (Char const   *)"hg_main.c", 262,   4310                         (Char const   *)"hg_main.c", 262,
4311                         (Char const   *)"lockN_acquire_writer", "");   4311                         (Char const   *)"lockN_acquire_writer", "");
4312   }   4312   }
4313   vgPlain_addToBag(lk->heldBy, (UWord )((Word )thr));   4313   vgPlain_addToBag(lk->heldBy, (UWord )((Word )thr));
4314   break;   4314   break;
4315   case 1003U:   4315   case 1003U:
4316   if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {   4316   if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {
4317     if (! lk->heldW) {   4317     if (! lk->heldW) {
4318     4318  
4319     } else {   4319     } else {
4320       vgPlain_assert_fail((Bool )0,   4320       vgPlain_assert_fail((Bool )0,
4321                           (Char const   *)"lk->heldBy == NULL && !lk->heldW",   4321                           (Char const   *)"lk->heldBy == NULL && !lk->heldW",
4322                           (Char const   *)"hg_main.c", 266,   4322                           (Char const   *)"hg_main.c", 266,
4323                           (Char const   *)"lockN_acquire_writer", "");   4323                           (Char const   *)"lockN_acquire_writer", "");
4324     }   4324     }
4325   } else {   4325   } else {
4326     vgPlain_assert_fail((Bool )0,   4326     vgPlain_assert_fail((Bool )0,
4327                         (Char const   *)"lk->heldBy == NULL && !lk->heldW",   4327                         (Char const   *)"lk->heldBy == NULL && !lk->heldW",
4328                         (Char const   *)"hg_main.c", 266,   4328                         (Char const   *)"hg_main.c", 266,
4329                         (Char const   *)"lockN_acquire_writer", "");   4329                         (Char const   *)"lockN_acquire_writer", "");
4330   }   4330   }
4331   goto case_LK_nonRec;   4331   goto case_LK_nonRec;
4332   default:   4332   default:
4333   vgPlain_assert_fail((Bool )0, (Char const   *)"0",   4333   vgPlain_assert_fail((Bool )0, (Char const   *)"0",
4334                       (Char const   *)"hg_main.c", 269,   4334                       (Char const   *)"hg_main.c", 269,
4335                       (Char const   *)"lockN_acquire_writer", "");   4335                       (Char const   *)"lockN_acquire_writer", "");
4336   }   4336   }
4337   tmp___4 = vgHelgrind_is_sane_LockN(lk);   4337   tmp___4 = vgHelgrind_is_sane_LockN(lk);
4338   if (tmp___4) {   4338   if (tmp___4) {
4339     4339  
4340   } else {   4340   } else {
4341     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   4341     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
4342                         (Char const   *)"hg_main.c", 271,   4342                         (Char const   *)"hg_main.c", 271,
4343                         (Char const   *)"lockN_acquire_writer", "");   4343                         (Char const   *)"lockN_acquire_writer", "");
4344   }   4344   }
4345   return;   4345   return;
4346 }   4346 }
4347 }   4347 }
4348 static void lockN_acquire_reader(Lock *lk , Thread *thr )   4348 static void lockN_acquire_reader(Lock *lk , Thread *thr )
4349 {   4349 {
4350   Bool tmp ;   4350   Bool tmp ;
4351   Bool tmp___0 ;   4351   Bool tmp___0 ;
4352   ThreadId tid ;   4352   ThreadId tid ;
4353   Bool tmp___1 ;   4353   Bool tmp___1 ;
4354     4354  
4355   {   4355   {
4356   tmp = vgHelgrind_is_sane_LockN(lk);   4356   tmp = vgHelgrind_is_sane_LockN(lk);
4357   if (tmp) {   4357   if (tmp) {
4358     4358  
4359   } else {   4359   } else {
4360     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   4360     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
4361                         (Char const   *)"hg_main.c", 276,   4361                         (Char const   *)"hg_main.c", 276,
4362                         (Char const   *)"lockN_acquire_reader", "");   4362                         (Char const   *)"lockN_acquire_reader", "");
4363   }   4363   }
4364   tmp___0 = vgHelgrind_is_sane_Thread(thr);   4364   tmp___0 = vgHelgrind_is_sane_Thread(thr);
4365   if (tmp___0) {   4365   if (tmp___0) {
4366     4366  
4367   } else {   4367   } else {
4368     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",   4368     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",
4369                         (Char const   *)"hg_main.c", 277,   4369                         (Char const   *)"hg_main.c", 277,
4370                         (Char const   *)"lockN_acquire_reader", "");   4370                         (Char const   *)"lockN_acquire_reader", "");
4371   }   4371   }
4372   if ((unsigned int )lk->kind == 1003U) {   4372   if ((unsigned int )lk->kind == 1003U) {
4373     4373  
4374   } else {   4374   } else {
4375     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->kind == LK_rdwr",   4375     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->kind == LK_rdwr",
4376                         (Char const   *)"hg_main.c", 279,   4376                         (Char const   *)"hg_main.c", 279,
4377                         (Char const   *)"lockN_acquire_reader", "");   4377                         (Char const   *)"lockN_acquire_reader", "");
4378   }   4378   }
4379   if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {   4379   if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {
4380     4380  
4381   } else   4381   } else
4382   if ((unsigned int )lk->heldBy != (unsigned int )((void *)0)) {   4382   if ((unsigned int )lk->heldBy != (unsigned int )((void *)0)) {
4383     if (! lk->heldW) {   4383     if (! lk->heldW) {
4384     4384  
4385     } else {   4385     } else {
4386       vgPlain_assert_fail((Bool )0,   4386       vgPlain_assert_fail((Bool )0,
4387                           (Char const   *)"lk->heldBy == NULL || (lk->heldBy != NULL && !lk->heldW)",   4387                           (Char const   *)"lk->heldBy == NULL || (lk->heldBy != NULL && !lk->heldW)",
4388                           (Char const   *)"hg_main.c", 282,   4388                           (Char const   *)"hg_main.c", 282,
4389                           (Char const   *)"lockN_acquire_reader", "");   4389                           (Char const   *)"lockN_acquire_reader", "");
4390     }   4390     }
4391   } else {   4391   } else {
4392     vgPlain_assert_fail((Bool )0,   4392     vgPlain_assert_fail((Bool )0,
4393                         (Char const   *)"lk->heldBy == NULL || (lk->heldBy != NULL && !lk->heldW)",   4393                         (Char const   *)"lk->heldBy == NULL || (lk->heldBy != NULL && !lk->heldW)",
4394                         (Char const   *)"hg_main.c", 282,   4394                         (Char const   *)"hg_main.c", 282,
4395                         (Char const   *)"lockN_acquire_reader", "");   4395                         (Char const   *)"lockN_acquire_reader", "");
4396   }   4396   }
4397   stats__lockN_acquires ++;   4397   stats__lockN_acquires ++;
4398   if ((unsigned int )lk->acquired_at == (unsigned int )((void *)0)) {   4398   if ((unsigned int )lk->acquired_at == (unsigned int )((void *)0)) {
4399     if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {   4399     if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {
4400     4400  
4401     } else {   4401     } else {
4402       vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy == NULL",   4402       vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy == NULL",
4403                           (Char const   *)"hg_main.c", 291,   4403                           (Char const   *)"hg_main.c", 291,
4404                           (Char const   *)"lockN_acquire_reader", "");   4404                           (Char const   *)"lockN_acquire_reader", "");
4405     }   4405     }
4406     tid = map_threads_maybe_reverse_lookup_SLOW(thr);   4406     tid = map_threads_maybe_reverse_lookup_SLOW(thr);
4407     lk->acquired_at = vgPlain_record_ExeContext(tid, (Word )0);   4407     lk->acquired_at = vgPlain_record_ExeContext(tid, (Word )0);
4408   } else   4408   } else
4409   if ((unsigned int )lk->heldBy != (unsigned int )((void *)0)) {   4409   if ((unsigned int )lk->heldBy != (unsigned int )((void *)0)) {
4410     4410  
4411   } else {   4411   } else {
4412     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy != NULL",   4412     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy != NULL",
4413                         (Char const   *)"hg_main.c", 296,   4413                         (Char const   *)"hg_main.c", 296,
4414                         (Char const   *)"lockN_acquire_reader", "");   4414                         (Char const   *)"lockN_acquire_reader", "");
4415   }   4415   }
4416   if (lk->heldBy) {   4416   if (lk->heldBy) {
4417     vgPlain_addToBag(lk->heldBy, (UWord )((Word )thr));   4417     vgPlain_addToBag(lk->heldBy, (UWord )((Word )thr));
4418   } else {   4418   } else {
4419     lk->heldW = (Bool )0;   4419     lk->heldW = (Bool )0;
4420     lk->heldBy = vgPlain_newBag(& vgHelgrind_zalloc, (HChar *)"hg.lNar.1",   4420     lk->heldBy = vgPlain_newBag(& vgHelgrind_zalloc, (HChar *)"hg.lNar.1",
4421                                 & vgHelgrind_free);   4421                                 & vgHelgrind_free);
4422     vgPlain_addToBag(lk->heldBy, (UWord )((Word )thr));   4422     vgPlain_addToBag(lk->heldBy, (UWord )((Word )thr));
4423   }   4423   }
4424   if (! lk->heldW) {   4424   if (! lk->heldW) {
4425     4425  
4426   } else {   4426   } else {
4427     vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldW",   4427     vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldW",
4428                         (Char const   *)"hg_main.c", 307,   4428                         (Char const   *)"hg_main.c", 307,
4429                         (Char const   *)"lockN_acquire_reader", "");   4429                         (Char const   *)"lockN_acquire_reader", "");
4430   }   4430   }
4431   tmp___1 = vgHelgrind_is_sane_LockN(lk);   4431   tmp___1 = vgHelgrind_is_sane_LockN(lk);
4432   if (tmp___1) {   4432   if (tmp___1) {
4433     4433  
4434   } else {   4434   } else {
4435     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   4435     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
4436                         (Char const   *)"hg_main.c", 308,   4436                         (Char const   *)"hg_main.c", 308,
4437                         (Char const   *)"lockN_acquire_reader", "");   4437                         (Char const   *)"lockN_acquire_reader", "");
4438   }   4438   }
4439   return;   4439   return;
4440 }   4440 }
4441 }   4441 }
4442 static void lockN_release(Lock *lk , Thread *thr )   4442 static void lockN_release(Lock *lk , Thread *thr )
4443 {   4443 {
4444   Bool b ;   4444   Bool b ;
4445   Bool tmp ;   4445   Bool tmp ;
4446   Bool tmp___0 ;   4446   Bool tmp___0 ;
4447   Bool tmp___1 ;   4447   Bool tmp___1 ;
4448   Bool tmp___2 ;   4448   Bool tmp___2 ;
4449     4449  
4450   {   4450   {
4451   tmp = vgHelgrind_is_sane_LockN(lk);   4451   tmp = vgHelgrind_is_sane_LockN(lk);
4452   if (tmp) {   4452   if (tmp) {
4453     4453  
4454   } else {   4454   } else {
4455     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   4455     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
4456                         (Char const   *)"hg_main.c", 318,   4456                         (Char const   *)"hg_main.c", 318,
4457                         (Char const   *)"lockN_release", "");   4457                         (Char const   *)"lockN_release", "");
4458   }   4458   }
4459   tmp___0 = vgHelgrind_is_sane_Thread(thr);   4459   tmp___0 = vgHelgrind_is_sane_Thread(thr);
4460   if (tmp___0) {   4460   if (tmp___0) {
4461     4461  
4462   } else {   4462   } else {
4463     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",   4463     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",
4464                         (Char const   *)"hg_main.c", 319,   4464                         (Char const   *)"hg_main.c", 319,
4465                         (Char const   *)"lockN_release", "");   4465                         (Char const   *)"lockN_release", "");
4466   }   4466   }
4467   if (lk->heldBy) {   4467   if (lk->heldBy) {
4468     4468  
4469   } else {   4469   } else {
4470     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy",   4470     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy",
4471                         (Char const   *)"hg_main.c", 321,   4471                         (Char const   *)"hg_main.c", 321,
4472                         (Char const   *)"lockN_release", "");   4472                         (Char const   *)"lockN_release", "");
4473   }   4473   }
4474   stats__lockN_releases ++;   4474   stats__lockN_releases ++;
4475   b = vgPlain_delFromBag(lk->heldBy, (UWord )((Word )thr));   4475   b = vgPlain_delFromBag(lk->heldBy, (UWord )((Word )thr));
4476   if (b) {   4476   if (b) {
4477     4477  
4478   } else {   4478   } else {
4479     vgPlain_assert_fail((Bool )0, (Char const   *)"b",   4479     vgPlain_assert_fail((Bool )0, (Char const   *)"b",
4480                         (Char const   *)"hg_main.c", 326,   4480                         (Char const   *)"hg_main.c", 326,
4481                         (Char const   *)"lockN_release", "");   4481                         (Char const   *)"lockN_release", "");
4482   }   4482   }
4483   if (lk->acquired_at) {   4483   if (lk->acquired_at) {
4484     4484  
4485   } else {   4485   } else {
4486     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->acquired_at",   4486     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->acquired_at",
4487                         (Char const   *)"hg_main.c", 328,   4487                         (Char const   *)"hg_main.c", 328,
4488                         (Char const   *)"lockN_release", "");   4488                         (Char const   *)"lockN_release", "");
4489   }   4489   }
4490   tmp___1 = vgPlain_isEmptyBag(lk->heldBy);   4490   tmp___1 = vgPlain_isEmptyBag(lk->heldBy);
4491   if (tmp___1) {   4491   if (tmp___1) {
4492     vgPlain_deleteBag(lk->heldBy);   4492     vgPlain_deleteBag(lk->heldBy);
4493     lk->heldBy = (WordBag *)((void *)0);   4493     lk->heldBy = (WordBag *)((void *)0);
4494     lk->heldW = (Bool )0;   4494     lk->heldW = (Bool )0;
4495     lk->acquired_at = (ExeContext *)((void *)0);   4495     lk->acquired_at = (ExeContext *)((void *)0);
4496   } else {   4496   } else {
4497     4497  
4498   }   4498   }
4499   tmp___2 = vgHelgrind_is_sane_LockN(lk);   4499   tmp___2 = vgHelgrind_is_sane_LockN(lk);
4500   if (tmp___2) {   4500   if (tmp___2) {
4501     4501  
4502   } else {   4502   } else {
4503     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   4503     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
4504                         (Char const   *)"hg_main.c", 335,   4504                         (Char const   *)"hg_main.c", 335,
4505                         (Char const   *)"lockN_release", "");   4505                         (Char const   *)"lockN_release", "");
4506   }   4506   }
4507   return;   4507   return;
4508 }   4508 }
4509 }   4509 }
4510 static void remove_Lock_from_locksets_of_all_owning_Threads(Lock *lk )   4510 static void remove_Lock_from_locksets_of_all_owning_Threads(Lock *lk )
4511 {   4511 {
4512   Thread *thr ;   4512   Thread *thr ;
4513   Bool tmp ;   4513   Bool tmp ;
4514   Bool tmp___0 ;   4514   Bool tmp___0 ;
4515   Bool tmp___1 ;   4515   Bool tmp___1 ;
4516   Bool tmp___2 ;   4516   Bool tmp___2 ;
4517     4517  
4518   {   4518   {
4519   if (! lk->heldBy) {   4519   if (! lk->heldBy) {
4520     if (! lk->heldW) {   4520     if (! lk->heldW) {
4521     4521  
4522     } else {   4522     } else {
4523       vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldW",   4523       vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldW",
4524                           (Char const   *)"hg_main.c", 342,   4524                           (Char const   *)"hg_main.c", 342,
4525                           (Char const   *)"remove_Lock_from_locksets_of_all_owning_Threads",   4525                           (Char const   *)"remove_Lock_from_locksets_of_all_owning_Threads",
4526                           "");   4526                           "");
4527     }   4527     }
4528     return;   4528     return;
4529   } else {   4529   } else {
4530     4530  
4531   }   4531   }
4532   vgPlain_initIterBag(lk->heldBy);   4532   vgPlain_initIterBag(lk->heldBy);
4533   while (1) {   4533   while (1) {
4534     tmp___2 = vgPlain_nextIterBag(lk->heldBy, (UWord *)((Word *)(& thr)),   4534     tmp___2 = vgPlain_nextIterBag(lk->heldBy, (UWord *)((Word *)(& thr)),
4535                                   (UWord *)((void *)0));   4535                                   (UWord *)((void *)0));
4536     if (tmp___2) {   4536     if (tmp___2) {
4537     4537  
4538     } else {   4538     } else {
4539       break;   4539       break;
4540     }   4540     }
4541     tmp = vgHelgrind_is_sane_Thread(thr);   4541     tmp = vgHelgrind_is_sane_Thread(thr);
4542     if (tmp) {   4542     if (tmp) {
4543     4543  
4544     } else {   4544     } else {
4545       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",   4545       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",
4546                           (Char const   *)"hg_main.c", 348,   4546                           (Char const   *)"hg_main.c", 348,
4547                           (Char const   *)"remove_Lock_from_locksets_of_all_owning_Threads",   4547                           (Char const   *)"remove_Lock_from_locksets_of_all_owning_Threads",
4548                           "");   4548                           "");
4549     }   4549     }
4550     tmp___0 = vgHelgrind_elemWS(univ_lsets, thr->locksetA, (UWord )((Word )lk));   4550     tmp___0 = vgHelgrind_elemWS(univ_lsets, thr->locksetA, (UWord )((Word )lk));
4551     if (tmp___0) {   4551     if (tmp___0) {
4552     4552  
4553     } else {   4553     } else {
4554       vgPlain_assert_fail((Bool )0,   4554       vgPlain_assert_fail((Bool )0,
4555                           (Char const   *)"HG_(elemWS)( univ_lsets, thr->locksetA, (Word)lk )",   4555                           (Char const   *)"HG_(elemWS)( univ_lsets, thr->locksetA, (Word)lk )",
4556                           (Char const   *)"hg_main.c", 350,   4556                           (Char const   *)"hg_main.c", 350,
4557                           (Char const   *)"remove_Lock_from_locksets_of_all_owning_Threads",   4557                           (Char const   *)"remove_Lock_from_locksets_of_all_owning_Threads",
4558                           "");   4558                           "");
4559     }   4559     }
4560     thr->locksetA = vgHelgrind_delFromWS(univ_lsets, thr->locksetA,   4560     thr->locksetA = vgHelgrind_delFromWS(univ_lsets, thr->locksetA,
4561                                          (UWord )((Word )lk));   4561                                          (UWord )((Word )lk));
4562     if (lk->heldW) {   4562     if (lk->heldW) {
4563       tmp___1 = vgHelgrind_elemWS(univ_lsets, thr->locksetW, (UWord )((Word )lk));   4563       tmp___1 = vgHelgrind_elemWS(univ_lsets, thr->locksetW, (UWord )((Word )lk));
4564       if (tmp___1) {   4564       if (tmp___1) {
4565     4565  
4566       } else {   4566       } else {
4567         vgPlain_assert_fail((Bool )0,   4567         vgPlain_assert_fail((Bool )0,
4568                             (Char const   *)"HG_(elemWS)( univ_lsets, thr->locksetW, (Word)lk )",   4568                             (Char const   *)"HG_(elemWS)( univ_lsets, thr->locksetW, (Word)lk )",
4569                             (Char const   *)"hg_main.c", 356,   4569                             (Char const   *)"hg_main.c", 356,
4570                             (Char const   *)"remove_Lock_from_locksets_of_all_owning_Threads",   4570                             (Char const   *)"remove_Lock_from_locksets_of_all_owning_Threads",
4571                             "");   4571                             "");
4572       }   4572       }
4573       thr->locksetW = vgHelgrind_delFromWS(univ_lsets, thr->locksetW,   4573       thr->locksetW = vgHelgrind_delFromWS(univ_lsets, thr->locksetW,
4574                                            (UWord )((Word )lk));   4574                                            (UWord )((Word )lk));
4575     } else {   4575     } else {
4576     4576  
4577     }   4577     }
4578   }   4578   }
4579   vgPlain_doneIterBag(lk->heldBy);   4579   vgPlain_doneIterBag(lk->heldBy);
4580   return;   4580   return;
4581 }   4581 }
4582 }   4582 }
4583 static int const   sHOW_ADMIN  =    (Int const   )0;   4583 static int const   sHOW_ADMIN  =    (Int const   )0;
4584 static void space(Int n )   4584 static void space(Int n )
4585 {   4585 {
4586   Int i ;   4586   Int i ;
4587   Char spaces[129] ;   4587   Char spaces[129] ;
4588     4588  
4589   {   4589   {
4590   if (n >= 0) {   4590   if (n >= 0) {
4591     if (n < 128) {   4591     if (n < 128) {
4592     4592  
4593     } else {   4593     } else {
4594       vgPlain_assert_fail((Bool )0, (Char const   *)"n >= 0 && n < 128",   4594       vgPlain_assert_fail((Bool )0, (Char const   *)"n >= 0 && n < 128",
4595                           (Char const   *)"hg_main.c", 380,   4595                           (Char const   *)"hg_main.c", 380,
4596                           (Char const   *)"space", "");   4596                           (Char const   *)"space", "");
4597     }   4597     }
4598   } else {   4598   } else {
4599     vgPlain_assert_fail((Bool )0, (Char const   *)"n >= 0 && n < 128",   4599     vgPlain_assert_fail((Bool )0, (Char const   *)"n >= 0 && n < 128",
4600                         (Char const   *)"hg_main.c", 380,   4600                         (Char const   *)"hg_main.c", 380,
4601                         (Char const   *)"space", "");   4601                         (Char const   *)"space", "");
4602   }   4602   }
4603   if (n == 0) {   4603   if (n == 0) {
4604     return;   4604     return;
4605   } else {   4605   } else {
4606     4606  
4607   }   4607   }
4608   i = 0;   4608   i = 0;
4609   while (i < n) {   4609   while (i < n) {
4610     spaces[i] = (Char )' ';   4610     spaces[i] = (Char )' ';
4611     i ++;   4611     i ++;
4612   }   4612   }
4613   spaces[i] = (Char )0;   4613   spaces[i] = (Char )0;
4614   if (i < 129) {   4614   if (i < 129) {
4615     4615  
4616   } else {   4616   } else {
4617     vgPlain_assert_fail((Bool )0, (Char const   *)"i < 128+1",   4617     vgPlain_assert_fail((Bool )0, (Char const   *)"i < 128+1",
4618                         (Char const   *)"hg_main.c", 386,   4618                         (Char const   *)"hg_main.c", 386,
4619                         (Char const   *)"space", "");   4619                         (Char const   *)"space", "");
4620   }   4620   }
4621   vgPlain_printf("%s", spaces);   4621   vgPlain_printf("%s", spaces);
4622   return;   4622   return;
4623 }   4623 }
4624 }   4624 }
4625 static void pp_Thread(Int d , Thread *t )   4625 static void pp_Thread(Int d , Thread *t )
4626 {   4626 {
4627     4627  
4628     4628  
4629   {   4629   {
4630   space(d);   4630   space(d);
4631   vgPlain_printf("Thread %p {\n", t);   4631   vgPlain_printf("Thread %p {\n", t);
4632   if (sHOW_ADMIN) {   4632   if (sHOW_ADMIN) {
4633     space(d + 3);   4633     space(d + 3);
4634     vgPlain_printf("admin    %p\n", t->admin);   4634     vgPlain_printf("admin    %p\n", t->admin);
4635     space(d + 3);   4635     space(d + 3);
4636     vgPlain_printf("magic    0x%x\n", t->magic);   4636     vgPlain_printf("magic    0x%x\n", t->magic);
4637   } else {   4637   } else {
4638     4638  
4639   }   4639   }
4640   space(d + 3);   4640   space(d + 3);
4641   vgPlain_printf("locksetA %d\n", (Int )t->locksetA);   4641   vgPlain_printf("locksetA %d\n", (Int )t->locksetA);
4642   space(d + 3);   4642   space(d + 3);
4643   vgPlain_printf("locksetW %d\n", (Int )t->locksetW);   4643   vgPlain_printf("locksetW %d\n", (Int )t->locksetW);
4644   space(d);   4644   space(d);
4645   vgPlain_printf("}\n");   4645   vgPlain_printf("}\n");
4646   return;   4646   return;
4647 }   4647 }
4648 }   4648 }
4649 static void pp_admin_threads(Int d )   4649 static void pp_admin_threads(Int d )
4650 {   4650 {
4651   Int i ;   4651   Int i ;
4652   Int n ;   4652   Int n ;
4653   Thread *t ;   4653   Thread *t ;
4654     4654  
4655   {   4655   {
4656   n = 0;   4656   n = 0;
4657   t = admin_threads;   4657   t = admin_threads;
4658   while (t) {   4658   while (t) {
4659     n ++;   4659     n ++;
4660     t = t->admin;   4660     t = t->admin;
4661   }   4661   }
4662   space(d);   4662   space(d);
4663   vgPlain_printf("admin_threads (%d records) {\n", n);   4663   vgPlain_printf("admin_threads (%d records) {\n", n);
4664   i = 0;   4664   i = 0;
4665   t = admin_threads;   4665   t = admin_threads;
4666   while (t) {   4666   while (t) {
4667     pp_Thread(d + 3, t);   4667     pp_Thread(d + 3, t);
4668     i ++;   4668     i ++;
4669     t = t->admin;   4669     t = t->admin;
4670   }   4670   }
4671   space(d);   4671   space(d);
4672   vgPlain_printf("}\n");   4672   vgPlain_printf("}\n");
4673   return;   4673   return;
4674 }   4674 }
4675 }   4675 }
4676 static void pp_map_threads(Int d )   4676 static void pp_map_threads(Int d )
4677 {   4677 {
4678   Int i ;   4678   Int i ;
4679   Int n ;   4679   Int n ;
4680     4680  
4681   {   4681   {
4682   n = 0;   4682   n = 0;
4683   space(d);   4683   space(d);
4684   vgPlain_printf("map_threads ");   4684   vgPlain_printf("map_threads ");
4685   i = 0;   4685   i = 0;
4686   while (i < 500) {   4686   while (i < 500) {
4687     if ((unsigned int )*(map_threads + i) != (unsigned int )((void *)0)) {   4687     if ((unsigned int )*(map_threads + i) != (unsigned int )((void *)0)) {
4688       n ++;   4688       n ++;
4689     } else {   4689     } else {
4690     4690  
4691     }   4691     }
4692     i ++;   4692     i ++;
4693   }   4693   }
4694   vgPlain_printf("(%d entries) {\n", n);   4694   vgPlain_printf("(%d entries) {\n", n);
4695   i = 0;   4695   i = 0;
4696   while (i < 500) {   4696   while (i < 500) {
4697     if ((unsigned int )*(map_threads + i) == (unsigned int )((void *)0)) {   4697     if ((unsigned int )*(map_threads + i) == (unsigned int )((void *)0)) {
4698       goto __Cont;   4698       goto __Cont;
4699     } else {   4699     } else {
4700     4700  
4701     }   4701     }
4702     space(d + 3);   4702     space(d + 3);
4703     vgPlain_printf("coretid %d -> Thread %p\n", i, *(map_threads + i));   4703     vgPlain_printf("coretid %d -> Thread %p\n", i, *(map_threads + i));
4704     __Cont: /* CIL Label */   4704     __Cont: /* CIL Label */
4705     i ++;   4705     i ++;
4706   }   4706   }
4707   space(d);   4707   space(d);
4708   vgPlain_printf("}\n");   4708   vgPlain_printf("}\n");
4709   return;   4709   return;
4710 }   4710 }
4711 }   4711 }
4712 static HChar const   *show_LockKind(LockKind lkk )   4712 static HChar const   *show_LockKind(LockKind lkk )
4713 {   4713 {
4714     4714  
4715     4715  
4716   {   4716   {
4717   switch ((unsigned int )lkk) {   4717   switch ((unsigned int )lkk) {
4718   case 1001U:   4718   case 1001U:
4719   return ("mbRec");   4719   return ("mbRec");
4720   case 1002U:   4720   case 1002U:
4721   return ("nonRec");   4721   return ("nonRec");
4722   case 1003U:   4722   case 1003U:
4723   return ("rdwr");   4723   return ("rdwr");
4724   default:   4724   default:
4725   vgPlain_assert_fail((Bool )0, (Char const   *)"0",   4725   vgPlain_assert_fail((Bool )0, (Char const   *)"0",
4726                       (Char const   *)"hg_main.c", 443,   4726                       (Char const   *)"hg_main.c", 443,
4727                       (Char const   *)"show_LockKind", "");   4727                       (Char const   *)"show_LockKind", "");
4728   }   4728   }
4729 }   4729 }
4730 }   4730 }
4731 static void pp_Lock(Int d , Lock *lk )   4731 static void pp_Lock(Int d , Lock *lk )
4732 {   4732 {
4733   HChar const   *tmp ;   4733   HChar const   *tmp ;
4734   char const   *tmp___0 ;   4734   char const   *tmp___0 ;
4735   Thread *thr ;   4735   Thread *thr ;
4736   Word count ;   4736   Word count ;
4737   Bool tmp___1 ;   4737   Bool tmp___1 ;
4738     4738  
4739   {   4739   {
4740   space(d);   4740   space(d);
4741   vgPlain_printf("Lock %p (ga %#lx) {\n", lk, lk->guestaddr);   4741   vgPlain_printf("Lock %p (ga %#lx) {\n", lk, lk->guestaddr);
4742   if (sHOW_ADMIN) {   4742   if (sHOW_ADMIN) {
4743     space(d + 3);   4743     space(d + 3);
4744     vgPlain_printf("admin_n  %p\n", lk->admin_next);   4744     vgPlain_printf("admin_n  %p\n", lk->admin_next);
4745     space(d + 3);   4745     space(d + 3);
4746     vgPlain_printf("admin_p  %p\n", lk->admin_prev);   4746     vgPlain_printf("admin_p  %p\n", lk->admin_prev);
4747     space(d + 3);   4747     space(d + 3);
4748     vgPlain_printf("magic    0x%x\n", lk->magic);   4748     vgPlain_printf("magic    0x%x\n", lk->magic);
4749   } else {   4749   } else {
4750     4750  
4751   }   4751   }
4752   space(d + 3);   4752   space(d + 3);
4753   vgPlain_printf("unique %llu\n", lk->unique);   4753   vgPlain_printf("unique %llu\n", lk->unique);
4754   space(d + 3);   4754   space(d + 3);
4755   tmp = show_LockKind(lk->kind);   4755   tmp = show_LockKind(lk->kind);
4756   vgPlain_printf("kind   %s\n", tmp);   4756   vgPlain_printf("kind   %s\n", tmp);
4757   space(d + 3);   4757   space(d + 3);
4758   if (lk->heldW) {   4758   if (lk->heldW) {
4759     tmp___0 = "yes";   4759     tmp___0 = "yes";
4760   } else {   4760   } else {
4761     tmp___0 = "no";   4761     tmp___0 = "no";
4762   }   4762   }
4763   vgPlain_printf("heldW  %s\n", tmp___0);   4763   vgPlain_printf("heldW  %s\n", tmp___0);
4764   space(d + 3);   4764   space(d + 3);
4765   vgPlain_printf("heldBy %p", lk->heldBy);   4765   vgPlain_printf("heldBy %p", lk->heldBy);
4766   if (lk->heldBy) {   4766   if (lk->heldBy) {
4767     vgPlain_printf(" { ");   4767     vgPlain_printf(" { ");
4768     vgPlain_initIterBag(lk->heldBy);   4768     vgPlain_initIterBag(lk->heldBy);
4769     while (1) {   4769     while (1) {
4770       tmp___1 = vgPlain_nextIterBag(lk->heldBy, (UWord *)((Word *)(& thr)),   4770       tmp___1 = vgPlain_nextIterBag(lk->heldBy, (UWord *)((Word *)(& thr)),
4771                                     (UWord *)(& count));   4771                                     (UWord *)(& count));
4772       if (tmp___1) {   4772       if (tmp___1) {
4773     4773  
4774       } else {   4774       } else {
4775         break;   4775         break;
4776       }   4776       }
4777       vgPlain_printf("%lu:%p ", count, thr);   4777       vgPlain_printf("%lu:%p ", count, thr);
4778     }   4778     }
4779     vgPlain_doneIterBag(lk->heldBy);   4779     vgPlain_doneIterBag(lk->heldBy);
4780     vgPlain_printf("}");   4780     vgPlain_printf("}");
4781   } else {   4781   } else {
4782     4782  
4783   }   4783   }
4784   vgPlain_printf("\n");   4784   vgPlain_printf("\n");
4785   space(d);   4785   space(d);
4786   vgPlain_printf("}\n");   4786   vgPlain_printf("}\n");
4787   return;   4787   return;
4788 }   4788 }
4789 }   4789 }
4790 static void pp_admin_locks(Int d )   4790 static void pp_admin_locks(Int d )
4791 {   4791 {
4792   Int i ;   4792   Int i ;
4793   Int n ;   4793   Int n ;
4794   Lock *lk ;   4794   Lock *lk ;
4795     4795  
4796   {   4796   {
4797   n = 0;   4797   n = 0;
4798   lk = admin_locks;   4798   lk = admin_locks;
4799   while (lk) {   4799   while (lk) {
4800     n ++;   4800     n ++;
4801     lk = lk->admin_next;   4801     lk = lk->admin_next;
4802   }   4802   }
4803   space(d);   4803   space(d);
4804   vgPlain_printf("admin_locks (%d records) {\n", n);   4804   vgPlain_printf("admin_locks (%d records) {\n", n);
4805   i = 0;   4805   i = 0;
4806   lk = admin_locks;   4806   lk = admin_locks;
4807   while (lk) {   4807   while (lk) {
4808     pp_Lock(d + 3, lk);   4808     pp_Lock(d + 3, lk);
4809     i ++;   4809     i ++;
4810     lk = lk->admin_next;   4810     lk = lk->admin_next;
4811   }   4811   }
4812   space(d);   4812   space(d);
4813   vgPlain_printf("}\n");   4813   vgPlain_printf("}\n");
4814   return;   4814   return;
4815 }   4815 }
4816 }   4816 }
4817 static void pp_map_locks(Int d )   4817 static void pp_map_locks(Int d )
4818 {   4818 {
4819   void *gla ;   4819   void *gla ;
4820   Lock *lk ;   4820   Lock *lk ;
4821   UWord tmp ;   4821   UWord tmp ;
4822   Bool tmp___0 ;   4822   Bool tmp___0 ;
4823     4823  
4824   {   4824   {
4825   space(d);   4825   space(d);
4826   tmp = vgPlain_sizeFM(map_locks);   4826   tmp = vgPlain_sizeFM(map_locks);
4827   vgPlain_printf("map_locks (%d entries) {\n", (Int )tmp);   4827   vgPlain_printf("map_locks (%d entries) {\n", (Int )tmp);
4828   vgPlain_initIterFM(map_locks);   4828   vgPlain_initIterFM(map_locks);
4829   while (1) {   4829   while (1) {
4830     tmp___0 = vgPlain_nextIterFM(map_locks, (UWord *)((Word *)(& gla)),   4830     tmp___0 = vgPlain_nextIterFM(map_locks, (UWord *)((Word *)(& gla)),
4831                                  (UWord *)((Word *)(& lk)));   4831                                  (UWord *)((Word *)(& lk)));
4832     if (tmp___0) {   4832     if (tmp___0) {
4833     4833  
4834     } else {   4834     } else {
4835       break;   4835       break;
4836     }   4836     }
4837     space(d + 3);   4837     space(d + 3);
4838     vgPlain_printf("guest %p -> Lock %p\n", gla, lk);   4838     vgPlain_printf("guest %p -> Lock %p\n", gla, lk);
4839   }   4839   }
4840   vgPlain_doneIterFM(map_locks);   4840   vgPlain_doneIterFM(map_locks);
4841   space(d);   4841   space(d);
4842   vgPlain_printf("}\n");   4842   vgPlain_printf("}\n");
4843   return;   4843   return;
4844 }   4844 }
4845 }   4845 }
4846 static void pp_everything(Int flags , Char *caller )   4846 static void pp_everything(Int flags , Char *caller )
4847 {   4847 {
4848   Int d ;   4848   Int d ;
4849     4849  
4850   {   4850   {
4851   d = 0;   4851   d = 0;
4852   vgPlain_printf("\n");   4852   vgPlain_printf("\n");
4853   vgPlain_printf("All_Data_Structures (caller = \"%s\") {\n", caller);   4853   vgPlain_printf("All_Data_Structures (caller = \"%s\") {\n", caller);
4854   if (flags & (1 << 1)) {   4854   if (flags & (1 << 1)) {
4855     vgPlain_printf("\n");   4855     vgPlain_printf("\n");
4856     pp_admin_threads(d + 3);   4856     pp_admin_threads(d + 3);
4857     vgPlain_printf("\n");   4857     vgPlain_printf("\n");
4858     pp_map_threads(d + 3);   4858     pp_map_threads(d + 3);
4859   } else {   4859   } else {
4860     4860  
4861   }   4861   }
4862   if (flags & (1 << 2)) {   4862   if (flags & (1 << 2)) {
4863     vgPlain_printf("\n");   4863     vgPlain_printf("\n");
4864     pp_admin_locks(d + 3);   4864     pp_admin_locks(d + 3);
4865     vgPlain_printf("\n");   4865     vgPlain_printf("\n");
4866     pp_map_locks(d + 3);   4866     pp_map_locks(d + 3);
4867   } else {   4867   } else {
4868     4868  
4869   }   4869   }
4870   vgPlain_printf("\n");   4870   vgPlain_printf("\n");
4871   vgPlain_printf("}\n");   4871   vgPlain_printf("}\n");
4872   vgPlain_printf("\n");   4872   vgPlain_printf("\n");
4873   return;   4873   return;
4874 }   4874 }
4875 }   4875 }
4876 static void initialise_data_structures(Thr *hbthr_root )   4876 static void initialise_data_structures(Thr *hbthr_root )
4877 {   4877 {
4878   Thread *thr ;   4878   Thread *thr ;
4879   void *tmp ;   4879   void *tmp ;
4880   Thread *tmp___0 ;   4880   Thread *tmp___0 ;
4881   Bool tmp___1 ;   4881   Bool tmp___1 ;
4882     4882  
4883   {   4883   {
4884   if ((unsigned int )admin_threads == (unsigned int )((void *)0)) {   4884   if ((unsigned int )admin_threads == (unsigned int )((void *)0)) {
4885     4885  
4886   } else {   4886   } else {
4887     vgPlain_assert_fail((Bool )0, (Char const   *)"admin_threads == NULL",   4887     vgPlain_assert_fail((Bool )0, (Char const   *)"admin_threads == NULL",
4888                         (Char const   *)"hg_main.c", 542,   4888                         (Char const   *)"hg_main.c", 542,
4889                         (Char const   *)"initialise_data_structures", "");   4889                         (Char const   *)"initialise_data_structures", "");
4890   }   4890   }
4891   if ((unsigned int )admin_locks == (unsigned int )((void *)0)) {   4891   if ((unsigned int )admin_locks == (unsigned int )((void *)0)) {
4892     4892  
4893   } else {   4893   } else {
4894     vgPlain_assert_fail((Bool )0, (Char const   *)"admin_locks == NULL",   4894     vgPlain_assert_fail((Bool )0, (Char const   *)"admin_locks == NULL",
4895                         (Char const   *)"hg_main.c", 543,   4895                         (Char const   *)"hg_main.c", 543,
4896                         (Char const   *)"initialise_data_structures", "");   4896                         (Char const   *)"initialise_data_structures", "");
4897   }   4897   }
4898   if (sizeof(Addr ) == sizeof(Word )) {   4898   if (sizeof(Addr ) == sizeof(Word )) {
4899     4899  
4900   } else {   4900   } else {
4901     vgPlain_assert_fail((Bool )0,   4901     vgPlain_assert_fail((Bool )0,
4902                         (Char const   *)"sizeof(Addr) == sizeof(Word)",   4902                         (Char const   *)"sizeof(Addr) == sizeof(Word)",
4903                         (Char const   *)"hg_main.c", 545,   4903                         (Char const   *)"hg_main.c", 545,
4904                         (Char const   *)"initialise_data_structures", "");   4904                         (Char const   *)"initialise_data_structures", "");
4905   }   4905   }
4906   if ((unsigned int )map_threads == (unsigned int )((void *)0)) {   4906   if ((unsigned int )map_threads == (unsigned int )((void *)0)) {
4907     4907  
4908   } else {   4908   } else {
4909     vgPlain_assert_fail((Bool )0, (Char const   *)"map_threads == NULL",   4909     vgPlain_assert_fail((Bool )0, (Char const   *)"map_threads == NULL",
4910                         (Char const   *)"hg_main.c", 547,   4910                         (Char const   *)"hg_main.c", 547,
4911                         (Char const   *)"initialise_data_structures", "");   4911                         (Char const   *)"initialise_data_structures", "");
4912   }   4912   }
4913   tmp = vgHelgrind_zalloc((HChar *)"hg.ids.1", (SizeT )(500U * sizeof(Thread *)));   4913   tmp = vgHelgrind_zalloc((HChar *)"hg.ids.1", (SizeT )(500U * sizeof(Thread *)));
4914   map_threads = (Thread **)tmp;   4914   map_threads = (Thread **)tmp;
4915   if ((unsigned int )map_threads != (unsigned int )((void *)0)) {   4915   if ((unsigned int )map_threads != (unsigned int )((void *)0)) {
4916     4916  
4917   } else {   4917   } else {
4918     vgPlain_assert_fail((Bool )0, (Char const   *)"map_threads != NULL",   4918     vgPlain_assert_fail((Bool )0, (Char const   *)"map_threads != NULL",
4919                         (Char const   *)"hg_main.c", 549,   4919                         (Char const   *)"hg_main.c", 549,
4920                         (Char const   *)"initialise_data_structures", "");   4920                         (Char const   *)"initialise_data_structures", "");
4921   }   4921   }
4922   if (sizeof(Addr ) == sizeof(Word )) {   4922   if (sizeof(Addr ) == sizeof(Word )) {
4923     4923  
4924   } else {   4924   } else {
4925     vgPlain_assert_fail((Bool )0,   4925     vgPlain_assert_fail((Bool )0,
4926                         (Char const   *)"sizeof(Addr) == sizeof(Word)",   4926                         (Char const   *)"sizeof(Addr) == sizeof(Word)",
4927                         (Char const   *)"hg_main.c", 551,   4927                         (Char const   *)"hg_main.c", 551,
4928                         (Char const   *)"initialise_data_structures", "");   4928                         (Char const   *)"initialise_data_structures", "");
4929   }   4929   }
4930   if ((unsigned int )map_locks == (unsigned int )((void *)0)) {   4930   if ((unsigned int )map_locks == (unsigned int )((void *)0)) {
4931     4931  
4932   } else {   4932   } else {
4933     vgPlain_assert_fail((Bool )0, (Char const   *)"map_locks == NULL",   4933     vgPlain_assert_fail((Bool )0, (Char const   *)"map_locks == NULL",
4934                         (Char const   *)"hg_main.c", 552,   4934                         (Char const   *)"hg_main.c", 552,
4935                         (Char const   *)"initialise_data_structures", "");   4935                         (Char const   *)"initialise_data_structures", "");
4936   }   4936   }
4937   map_locks = vgPlain_newFM(& vgHelgrind_zalloc, (HChar *)"hg.ids.2",   4937   map_locks = vgPlain_newFM(& vgHelgrind_zalloc, (HChar *)"hg.ids.2",
4938                             & vgHelgrind_free,   4938                             & vgHelgrind_free,
4939                             (Word (*)(UWord  , UWord  ))((void *)0));   4939                             (Word (*)(UWord  , UWord  ))((void *)0));
4940   if ((unsigned int )map_locks != (unsigned int )((void *)0)) {   4940   if ((unsigned int )map_locks != (unsigned int )((void *)0)) {
4941     4941  
4942   } else {   4942   } else {
4943     vgPlain_assert_fail((Bool )0, (Char const   *)"map_locks != NULL",   4943     vgPlain_assert_fail((Bool )0, (Char const   *)"map_locks != NULL",
4944                         (Char const   *)"hg_main.c", 555,   4944                         (Char const   *)"hg_main.c", 555,
4945                         (Char const   *)"initialise_data_structures", "");   4945                         (Char const   *)"initialise_data_structures", "");
4946   }   4946   }
4947   if ((unsigned int )univ_lsets == (unsigned int )((void *)0)) {   4947   if ((unsigned int )univ_lsets == (unsigned int )((void *)0)) {
4948     4948  
4949   } else {   4949   } else {
4950     vgPlain_assert_fail((Bool )0, (Char const   *)"univ_lsets == NULL",   4950     vgPlain_assert_fail((Bool )0, (Char const   *)"univ_lsets == NULL",
4951                         (Char const   *)"hg_main.c", 557,   4951                         (Char const   *)"hg_main.c", 557,
4952                         (Char const   *)"initialise_data_structures", "");   4952                         (Char const   *)"initialise_data_structures", "");
4953   }   4953   }
4954   univ_lsets = vgHelgrind_newWordSetU(& vgHelgrind_zalloc, (HChar *)"hg.ids.4",   4954   univ_lsets = vgHelgrind_newWordSetU(& vgHelgrind_zalloc, (HChar *)"hg.ids.4",
4955                                       & vgHelgrind_free, (Word )8);   4955                                       & vgHelgrind_free, (Word )8);
4956   if ((unsigned int )univ_lsets != (unsigned int )((void *)0)) {   4956   if ((unsigned int )univ_lsets != (unsigned int )((void *)0)) {
4957     4957  
4958   } else {   4958   } else {
4959     vgPlain_assert_fail((Bool )0, (Char const   *)"univ_lsets != NULL",   4959     vgPlain_assert_fail((Bool )0, (Char const   *)"univ_lsets != NULL",
4960                         (Char const   *)"hg_main.c", 560,   4960                         (Char const   *)"hg_main.c", 560,
4961                         (Char const   *)"initialise_data_structures", "");   4961                         (Char const   *)"initialise_data_structures", "");
4962   }   4962   }
4963   if ((unsigned int )univ_laog == (unsigned int )((void *)0)) {   4963   if ((unsigned int )univ_laog == (unsigned int )((void *)0)) {
4964     4964  
4965   } else {   4965   } else {
4966     vgPlain_assert_fail((Bool )0, (Char const   *)"univ_laog == NULL",   4966     vgPlain_assert_fail((Bool )0, (Char const   *)"univ_laog == NULL",
4967                         (Char const   *)"hg_main.c", 562,   4967                         (Char const   *)"hg_main.c", 562,
4968                         (Char const   *)"initialise_data_structures", "");   4968                         (Char const   *)"initialise_data_structures", "");
4969   }   4969   }
4970   if (vgHelgrind_clo_track_lockorders) {   4970   if (vgHelgrind_clo_track_lockorders) {
4971     univ_laog = vgHelgrind_newWordSetU(& vgHelgrind_zalloc,   4971     univ_laog = vgHelgrind_newWordSetU(& vgHelgrind_zalloc,
4972                                        (HChar *)"hg.ids.5 (univ_laog)",   4972                                        (HChar *)"hg.ids.5 (univ_laog)",
4973                                        & vgHelgrind_free, (Word )24);   4973                                        & vgHelgrind_free, (Word )24);
4974     if ((unsigned int )univ_laog != (unsigned int )((void *)0)) {   4974     if ((unsigned int )univ_laog != (unsigned int )((void *)0)) {
4975     4975  
4976     } else {   4976     } else {
4977       vgPlain_assert_fail((Bool )0, (Char const   *)"univ_laog != NULL",   4977       vgPlain_assert_fail((Bool )0, (Char const   *)"univ_laog != NULL",
4978                           (Char const   *)"hg_main.c", 566,   4978                           (Char const   *)"hg_main.c", 566,
4979                           (Char const   *)"initialise_data_structures", "");   4979                           (Char const   *)"initialise_data_structures", "");
4980     }   4980     }
4981   } else {   4981   } else {
4982     4982  
4983   }   4983   }
4984   thr = mk_Thread(hbthr_root);   4984   thr = mk_Thread(hbthr_root);
4985   thr->coretid = (ThreadId )1;   4985   thr->coretid = (ThreadId )1;
4986   tmp___0 = libhb_get_Thr_hgthread(hbthr_root);   4986   tmp___0 = libhb_get_Thr_hgthread(hbthr_root);
4987   if ((unsigned int )tmp___0 == (unsigned int )((void *)0)) {   4987   if ((unsigned int )tmp___0 == (unsigned int )((void *)0)) {
4988     4988  
4989   } else {   4989   } else {
4990     vgPlain_assert_fail((Bool )0,   4990     vgPlain_assert_fail((Bool )0,
4991                         (Char const   *)"libhb_get_Thr_hgthread(hbthr_root) == NULL",   4991                         (Char const   *)"libhb_get_Thr_hgthread(hbthr_root) == NULL",
4992                         (Char const   *)"hg_main.c", 576,   4992                         (Char const   *)"hg_main.c", 576,
4993                         (Char const   *)"initialise_data_structures", "");   4993                         (Char const   *)"initialise_data_structures", "");
4994   }   4994   }
4995   libhb_set_Thr_hgthread(hbthr_root, thr);   4995   libhb_set_Thr_hgthread(hbthr_root, thr);
4996   tmp___1 = vgHelgrind_is_sane_ThreadId(thr->coretid);   4996   tmp___1 = vgHelgrind_is_sane_ThreadId(thr->coretid);
4997   if (tmp___1) {   4997   if (tmp___1) {
4998     4998  
4999   } else {   4999   } else {
5000     vgPlain_assert_fail((Bool )0,   5000     vgPlain_assert_fail((Bool )0,
5001                         (Char const   *)"HG_(is_sane_ThreadId)(thr->coretid)",   5001                         (Char const   *)"HG_(is_sane_ThreadId)(thr->coretid)",
5002                         (Char const   *)"hg_main.c", 580,   5002                         (Char const   *)"hg_main.c", 580,
5003                         (Char const   *)"initialise_data_structures", "");   5003                         (Char const   *)"initialise_data_structures", "");
5004   }   5004   }
5005   if (thr->coretid != 0U) {   5005   if (thr->coretid != 0U) {
5006     5006  
5007   } else {   5007   } else {
5008     vgPlain_assert_fail((Bool )0,   5008     vgPlain_assert_fail((Bool )0,
5009                         (Char const   *)"thr->coretid != VG_INVALID_THREADID",   5009                         (Char const   *)"thr->coretid != VG_INVALID_THREADID",
5010                         (Char const   *)"hg_main.c", 581,   5010                         (Char const   *)"hg_main.c", 581,
5011                         (Char const   *)"initialise_data_structures", "");   5011                         (Char const   *)"initialise_data_structures", "");
5012   }   5012   }
5013   *(map_threads + thr->coretid) = thr;   5013   *(map_threads + thr->coretid) = thr;
5014   all__sanity_check((Char *)"initialise_data_structures");   5014   all__sanity_check((Char *)"initialise_data_structures");
5015   return;   5015   return;
5016 }   5016 }
5017 }   5017 }
5018 static Thread *map_threads_maybe_lookup(ThreadId coretid )   5018 static Thread *map_threads_maybe_lookup(ThreadId coretid )
5019 {   5019 {
5020   Thread *thr ;   5020   Thread *thr ;
5021   Bool tmp ;   5021   Bool tmp ;
5022     5022  
5023   {   5023   {
5024   tmp = vgHelgrind_is_sane_ThreadId(coretid);   5024   tmp = vgHelgrind_is_sane_ThreadId(coretid);
5025   if (tmp) {   5025   if (tmp) {
5026     5026  
5027   } else {   5027   } else {
5028     vgPlain_assert_fail((Bool )0,   5028     vgPlain_assert_fail((Bool )0,
5029                         (Char const   *)"HG_(is_sane_ThreadId)(coretid)",   5029                         (Char const   *)"HG_(is_sane_ThreadId)(coretid)",
5030                         (Char const   *)"hg_main.c", 599,   5030                         (Char const   *)"hg_main.c", 599,
5031                         (Char const   *)"map_threads_maybe_lookup", "");   5031                         (Char const   *)"map_threads_maybe_lookup", "");
5032   }   5032   }
5033   thr = *(map_threads + coretid);   5033   thr = *(map_threads + coretid);
5034   return (thr);   5034   return (thr);
5035 }   5035 }
5036 }   5036 }
5037 __inline static Thread *map_threads_lookup(ThreadId coretid )   5037 __inline static Thread *map_threads_lookup(ThreadId coretid )
5038 {   5038 {
5039   Thread *thr ;   5039   Thread *thr ;
5040   Bool tmp ;   5040   Bool tmp ;
5041     5041  
5042   {   5042   {
5043   tmp = vgHelgrind_is_sane_ThreadId(coretid);   5043   tmp = vgHelgrind_is_sane_ThreadId(coretid);
5044   if (tmp) {   5044   if (tmp) {
5045     5045  
5046   } else {   5046   } else {
5047     vgPlain_assert_fail((Bool )0,   5047     vgPlain_assert_fail((Bool )0,
5048                         (Char const   *)"HG_(is_sane_ThreadId)(coretid)",   5048                         (Char const   *)"HG_(is_sane_ThreadId)(coretid)",
5049                         (Char const   *)"hg_main.c", 608,   5049                         (Char const   *)"hg_main.c", 608,
5050                         (Char const   *)"map_threads_lookup", "");   5050                         (Char const   *)"map_threads_lookup", "");
5051   }   5051   }
5052   thr = *(map_threads + coretid);   5052   thr = *(map_threads + coretid);
5053   if (thr) {   5053   if (thr) {
5054     5054  
5055   } else {   5055   } else {
5056     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   5056     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
5057                         (Char const   *)"hg_main.c", 610,   5057                         (Char const   *)"hg_main.c", 610,
5058                         (Char const   *)"map_threads_lookup", "");   5058                         (Char const   *)"map_threads_lookup", "");
5059   }   5059   }
5060   return (thr);   5060   return (thr);
5061 }   5061 }
5062 }   5062 }
5063 static ThreadId map_threads_maybe_reverse_lookup_SLOW(Thread *thr )   5063 static ThreadId map_threads_maybe_reverse_lookup_SLOW(Thread *thr )
5064 {   5064 {
5065   ThreadId tid ;   5065   ThreadId tid ;
5066   Bool tmp ;   5066   Bool tmp ;
5067   Bool tmp___0 ;   5067   Bool tmp___0 ;
5068     5068  
5069   {   5069   {
5070   tmp = vgHelgrind_is_sane_Thread(thr);   5070   tmp = vgHelgrind_is_sane_Thread(thr);
5071   if (tmp) {   5071   if (tmp) {
5072     5072  
5073   } else {   5073   } else {
5074     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",   5074     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",
5075                         (Char const   *)"hg_main.c", 619,   5075                         (Char const   *)"hg_main.c", 619,
5076                         (Char const   *)"map_threads_maybe_reverse_lookup_SLOW",   5076                         (Char const   *)"map_threads_maybe_reverse_lookup_SLOW",
5077                         "");   5077                         "");
5078   }   5078   }
5079   if ((unsigned int )*(map_threads + 0U) == (unsigned int )((void *)0)) {   5079   if ((unsigned int )*(map_threads + 0U) == (unsigned int )((void *)0)) {
5080     5080  
5081   } else {   5081   } else {
5082     vgPlain_assert_fail((Bool )0,   5082     vgPlain_assert_fail((Bool )0,
5083                         (Char const   *)"map_threads[VG_INVALID_THREADID] == NULL",   5083                         (Char const   *)"map_threads[VG_INVALID_THREADID] == NULL",
5084                         (Char const   *)"hg_main.c", 622,   5084                         (Char const   *)"hg_main.c", 622,
5085                         (Char const   *)"map_threads_maybe_reverse_lookup_SLOW",   5085                         (Char const   *)"map_threads_maybe_reverse_lookup_SLOW",
5086                         "");   5086                         "");
5087   }   5087   }
5088   tid = thr->coretid;   5088   tid = thr->coretid;
5089   tmp___0 = vgHelgrind_is_sane_ThreadId(tid);   5089   tmp___0 = vgHelgrind_is_sane_ThreadId(tid);
5090   if (tmp___0) {   5090   if (tmp___0) {
5091     5091  
5092   } else {   5092   } else {
5093     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_ThreadId)(tid)",   5093     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_ThreadId)(tid)",
5094                         (Char const   *)"hg_main.c", 624,   5094                         (Char const   *)"hg_main.c", 624,
5095                         (Char const   *)"map_threads_maybe_reverse_lookup_SLOW",   5095                         (Char const   *)"map_threads_maybe_reverse_lookup_SLOW",
5096                         "");   5096                         "");
5097   }   5097   }
5098   return (tid);   5098   return (tid);
5099 }   5099 }
5100 }   5100 }
5101 static ThreadId map_threads_reverse_lookup_SLOW(Thread *thr )   5101 static ThreadId map_threads_reverse_lookup_SLOW(Thread *thr )
5102 {   5102 {
5103   ThreadId tid ;   5103   ThreadId tid ;
5104   ThreadId tmp ;   5104   ThreadId tmp ;
5105     5105  
5106   {   5106   {
5107   tmp = map_threads_maybe_reverse_lookup_SLOW(thr);   5107   tmp = map_threads_maybe_reverse_lookup_SLOW(thr);
5108   tid = tmp;   5108   tid = tmp;
5109   if (tid != 0U) {   5109   if (tid != 0U) {
5110     5110  
5111   } else {   5111   } else {
5112     vgPlain_assert_fail((Bool )0, (Char const   *)"tid != VG_INVALID_THREADID",   5112     vgPlain_assert_fail((Bool )0, (Char const   *)"tid != VG_INVALID_THREADID",
5113                         (Char const   *)"hg_main.c", 633,   5113                         (Char const   *)"hg_main.c", 633,
5114                         (Char const   *)"map_threads_reverse_lookup_SLOW", "");   5114                         (Char const   *)"map_threads_reverse_lookup_SLOW", "");
5115   }   5115   }
5116   if (*(map_threads + tid)) {   5116   if (*(map_threads + tid)) {
5117     5117  
5118   } else {   5118   } else {
5119     vgPlain_assert_fail((Bool )0, (Char const   *)"map_threads[tid]",   5119     vgPlain_assert_fail((Bool )0, (Char const   *)"map_threads[tid]",
5120                         (Char const   *)"hg_main.c", 634,   5120                         (Char const   *)"hg_main.c", 634,
5121                         (Char const   *)"map_threads_reverse_lookup_SLOW", "");   5121                         (Char const   *)"map_threads_reverse_lookup_SLOW", "");
5122   }   5122   }
5123   if ((*(map_threads + tid))->coretid == tid) {   5123   if ((*(map_threads + tid))->coretid == tid) {
5124     5124  
5125   } else {   5125   } else {
5126     vgPlain_assert_fail((Bool )0,   5126     vgPlain_assert_fail((Bool )0,
5127                         (Char const   *)"map_threads[tid]->coretid == tid",   5127                         (Char const   *)"map_threads[tid]->coretid == tid",
5128                         (Char const   *)"hg_main.c", 635,   5128                         (Char const   *)"hg_main.c", 635,
5129                         (Char const   *)"map_threads_reverse_lookup_SLOW", "");   5129                         (Char const   *)"map_threads_reverse_lookup_SLOW", "");
5130   }   5130   }
5131   return (tid);   5131   return (tid);
5132 }   5132 }
5133 }   5133 }
5134 static void map_threads_delete(ThreadId coretid )   5134 static void map_threads_delete(ThreadId coretid )
5135 {   5135 {
5136   Thread *thr ;   5136   Thread *thr ;
5137   Bool tmp ;   5137   Bool tmp ;
5138     5138  
5139   {   5139   {
5140   if (coretid != 0U) {   5140   if (coretid != 0U) {
5141     5141  
5142   } else {   5142   } else {
5143     vgPlain_assert_fail((Bool )0, (Char const   *)"coretid != 0",   5143     vgPlain_assert_fail((Bool )0, (Char const   *)"coretid != 0",
5144                         (Char const   *)"hg_main.c", 642,   5144                         (Char const   *)"hg_main.c", 642,
5145                         (Char const   *)"map_threads_delete", "");   5145                         (Char const   *)"map_threads_delete", "");
5146   }   5146   }
5147   tmp = vgHelgrind_is_sane_ThreadId(coretid);   5147   tmp = vgHelgrind_is_sane_ThreadId(coretid);
5148   if (tmp) {   5148   if (tmp) {
5149     5149  
5150   } else {   5150   } else {
5151     vgPlain_assert_fail((Bool )0,   5151     vgPlain_assert_fail((Bool )0,
5152                         (Char const   *)"HG_(is_sane_ThreadId)(coretid)",   5152                         (Char const   *)"HG_(is_sane_ThreadId)(coretid)",
5153                         (Char const   *)"hg_main.c", 643,   5153                         (Char const   *)"hg_main.c", 643,
5154                         (Char const   *)"map_threads_delete", "");   5154                         (Char const   *)"map_threads_delete", "");
5155   }   5155   }
5156   thr = *(map_threads + coretid);   5156   thr = *(map_threads + coretid);
5157   if (thr) {   5157   if (thr) {
5158     5158  
5159   } else {   5159   } else {
5160     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   5160     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
5161                         (Char const   *)"hg_main.c", 645,   5161                         (Char const   *)"hg_main.c", 645,
5162                         (Char const   *)"map_threads_delete", "");   5162                         (Char const   *)"map_threads_delete", "");
5163   }   5163   }
5164   *(map_threads + coretid) = (Thread *)((void *)0);   5164   *(map_threads + coretid) = (Thread *)((void *)0);
5165   return;   5165   return;
5166 }   5166 }
5167 }   5167 }
5168 static Lock *map_locks_lookup_or_create(LockKind lkk , Addr ga , ThreadId tid )   5168 static Lock *map_locks_lookup_or_create(LockKind lkk , Addr ga , ThreadId tid )
5169 {   5169 {
5170   Bool found ;   5170   Bool found ;
5171   Lock *oldlock ;   5171   Lock *oldlock ;
5172   Bool tmp ;   5172   Bool tmp ;
5173   Lock *lock ;   5173   Lock *lock ;
5174   Lock *tmp___0 ;   5174   Lock *tmp___0 ;
5175   Bool tmp___1 ;   5175   Bool tmp___1 ;
5176   Bool tmp___2 ;   5176   Bool tmp___2 ;
5177     5177  
5178   {   5178   {
5179   oldlock = (Lock *)((void *)0);   5179   oldlock = (Lock *)((void *)0);
5180   tmp = vgHelgrind_is_sane_ThreadId(tid);   5180   tmp = vgHelgrind_is_sane_ThreadId(tid);
5181   if (tmp) {   5181   if (tmp) {
5182     5182  
5183   } else {   5183   } else {
5184     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_ThreadId)(tid)",   5184     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_ThreadId)(tid)",
5185                         (Char const   *)"hg_main.c", 662,   5185                         (Char const   *)"hg_main.c", 662,
5186                         (Char const   *)"map_locks_lookup_or_create", "");   5186                         (Char const   *)"map_locks_lookup_or_create", "");
5187   }   5187   }
5188   found = vgPlain_lookupFM(map_locks, (UWord *)((void *)0),   5188   found = vgPlain_lookupFM(map_locks, (UWord *)((void *)0),
5189                            (UWord *)((Word *)(& oldlock)), (UWord )((Word )ga));   5189                            (UWord *)((Word *)(& oldlock)), (UWord )((Word )ga));
5190   if (! found) {   5190   if (! found) {
5191     tmp___0 = mk_LockN(lkk, ga);   5191     tmp___0 = mk_LockN(lkk, ga);
5192     lock = tmp___0;   5192     lock = tmp___0;
5193     lock->appeared_at = vgPlain_record_ExeContext(tid, (Word )0);   5193     lock->appeared_at = vgPlain_record_ExeContext(tid, (Word )0);
5194     tmp___1 = vgHelgrind_is_sane_LockN(lock);   5194     tmp___1 = vgHelgrind_is_sane_LockN(lock);
5195     if (tmp___1) {   5195     if (tmp___1) {
5196     5196  
5197     } else {   5197     } else {
5198       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lock)",   5198       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lock)",
5199                           (Char const   *)"hg_main.c", 668,   5199                           (Char const   *)"hg_main.c", 668,
5200                           (Char const   *)"map_locks_lookup_or_create", "");   5200                           (Char const   *)"map_locks_lookup_or_create", "");
5201     }   5201     }
5202     vgPlain_addToFM(map_locks, (UWord )((Word )ga), (UWord )((Word )lock));   5202     vgPlain_addToFM(map_locks, (UWord )((Word )ga), (UWord )((Word )lock));
5203     if ((unsigned int )oldlock == (unsigned int )((void *)0)) {   5203     if ((unsigned int )oldlock == (unsigned int )((void *)0)) {
5204     5204  
5205     } else {   5205     } else {
5206       vgPlain_assert_fail((Bool )0, (Char const   *)"oldlock == NULL",   5206       vgPlain_assert_fail((Bool )0, (Char const   *)"oldlock == NULL",
5207                           (Char const   *)"hg_main.c", 670,   5207                           (Char const   *)"hg_main.c", 670,
5208                           (Char const   *)"map_locks_lookup_or_create", "");   5208                           (Char const   *)"map_locks_lookup_or_create", "");
5209     }   5209     }
5210     return (lock);   5210     return (lock);
5211   } else {   5211   } else {
5212     if ((unsigned int )oldlock != (unsigned int )((void *)0)) {   5212     if ((unsigned int )oldlock != (unsigned int )((void *)0)) {
5213     5213  
5214     } else {   5214     } else {
5215       vgPlain_assert_fail((Bool )0, (Char const   *)"oldlock != NULL",   5215       vgPlain_assert_fail((Bool )0, (Char const   *)"oldlock != NULL",
5216                           (Char const   *)"hg_main.c", 673,   5216                           (Char const   *)"hg_main.c", 673,
5217                           (Char const   *)"map_locks_lookup_or_create", "");   5217                           (Char const   *)"map_locks_lookup_or_create", "");
5218     }   5218     }
5219     tmp___2 = vgHelgrind_is_sane_LockN(oldlock);   5219     tmp___2 = vgHelgrind_is_sane_LockN(oldlock);
5220     if (tmp___2) {   5220     if (tmp___2) {
5221     5221  
5222     } else {   5222     } else {
5223       vgPlain_assert_fail((Bool )0,   5223       vgPlain_assert_fail((Bool )0,
5224                           (Char const   *)"HG_(is_sane_LockN)(oldlock)",   5224                           (Char const   *)"HG_(is_sane_LockN)(oldlock)",
5225                           (Char const   *)"hg_main.c", 674,   5225                           (Char const   *)"hg_main.c", 674,
5226                           (Char const   *)"map_locks_lookup_or_create", "");   5226                           (Char const   *)"map_locks_lookup_or_create", "");
5227     }   5227     }
5228     if (oldlock->guestaddr == ga) {   5228     if (oldlock->guestaddr == ga) {
5229     5229  
5230     } else {   5230     } else {
5231       vgPlain_assert_fail((Bool )0, (Char const   *)"oldlock->guestaddr == ga",   5231       vgPlain_assert_fail((Bool )0, (Char const   *)"oldlock->guestaddr == ga",
5232                           (Char const   *)"hg_main.c", 675,   5232                           (Char const   *)"hg_main.c", 675,
5233                           (Char const   *)"map_locks_lookup_or_create", "");   5233                           (Char const   *)"map_locks_lookup_or_create", "");
5234     }   5234     }
5235     return (oldlock);   5235     return (oldlock);
5236   }   5236   }
5237 }   5237 }
5238 }   5238 }
5239 static Lock *map_locks_maybe_lookup(Addr ga )   5239 static Lock *map_locks_maybe_lookup(Addr ga )
5240 {   5240 {
5241   Bool found ;   5241   Bool found ;
5242   Lock *lk ;   5242   Lock *lk ;
5243   int tmp ;   5243   int tmp ;
5244     5244  
5245   {   5245   {
5246   lk = (Lock *)((void *)0);   5246   lk = (Lock *)((void *)0);
5247   found = vgPlain_lookupFM(map_locks, (UWord *)((void *)0),   5247   found = vgPlain_lookupFM(map_locks, (UWord *)((void *)0),
5248                            (UWord *)((Word *)(& lk)), (UWord )((Word )ga));   5248                            (UWord *)((Word *)(& lk)), (UWord )((Word )ga));
5249   if (found) {   5249   if (found) {
5250     tmp = (unsigned int )lk != (unsigned int )((void *)0);   5250     tmp = (unsigned int )lk != (unsigned int )((void *)0);
5251   } else {   5251   } else {
5252     tmp = (unsigned int )lk == (unsigned int )((void *)0);   5252     tmp = (unsigned int )lk == (unsigned int )((void *)0);
5253   }   5253   }
5254   if (tmp) {   5254   if (tmp) {
5255     5255  
5256   } else {   5256   } else {
5257     vgPlain_assert_fail((Bool )0,   5257     vgPlain_assert_fail((Bool )0,
5258                         (Char const   *)"found ? lk != NULL : lk == NULL",   5258                         (Char const   *)"found ? lk != NULL : lk == NULL",
5259                         (Char const   *)"hg_main.c", 685,   5259                         (Char const   *)"hg_main.c", 685,
5260                         (Char const   *)"map_locks_maybe_lookup", "");   5260                         (Char const   *)"map_locks_maybe_lookup", "");
5261   }   5261   }
5262   return (lk);   5262   return (lk);
5263 }   5263 }
5264 }   5264 }
5265 static void map_locks_delete(Addr ga )   5265 static void map_locks_delete(Addr ga )
5266 {   5266 {
5267   Addr ga2 ;   5267   Addr ga2 ;
5268   Lock *lk ;   5268   Lock *lk ;
5269     5269  
5270   {   5270   {
5271   ga2 = (Addr )0;   5271   ga2 = (Addr )0;
5272   lk = (Lock *)((void *)0);   5272   lk = (Lock *)((void *)0);
5273   vgPlain_delFromFM(map_locks, (UWord *)((Word *)(& ga2)),   5273   vgPlain_delFromFM(map_locks, (UWord *)((Word *)(& ga2)),
5274                     (UWord *)((Word *)(& lk)), (UWord )((Word )ga));   5274                     (UWord *)((Word *)(& lk)), (UWord )((Word )ga));
5275   if ((unsigned int )lk != (unsigned int )((void *)0)) {   5275   if ((unsigned int )lk != (unsigned int )((void *)0)) {
5276     5276  
5277   } else {   5277   } else {
5278     vgPlain_assert_fail((Bool )0, (Char const   *)"lk != NULL",   5278     vgPlain_assert_fail((Bool )0, (Char const   *)"lk != NULL",
5279                         (Char const   *)"hg_main.c", 698,   5279                         (Char const   *)"hg_main.c", 698,
5280                         (Char const   *)"map_locks_delete", "");   5280                         (Char const   *)"map_locks_delete", "");
5281   }   5281   }
5282   if (ga2 == ga) {   5282   if (ga2 == ga) {
5283     5283  
5284   } else {   5284   } else {
5285     vgPlain_assert_fail((Bool )0, (Char const   *)"ga2 == ga",   5285     vgPlain_assert_fail((Bool )0, (Char const   *)"ga2 == ga",
5286                         (Char const   *)"hg_main.c", 699,   5286                         (Char const   *)"hg_main.c", 699,
5287                         (Char const   *)"map_locks_delete", "");   5287                         (Char const   *)"map_locks_delete", "");
5288   }   5288   }
5289   return;   5289   return;
5290 }   5290 }
5291 }   5291 }
5292 static UWord stats__sanity_checks  =    (UWord )0;   5292 static UWord stats__sanity_checks  =    (UWord )0;
5293 static void ( __attribute__((__noinline__)) laog__sanity_check)(Char *who ) ;   5293 static void ( __attribute__((__noinline__)) laog__sanity_check)(Char *who ) ;
5294 static Bool thread_is_a_holder_of_Lock(Thread *thr , Lock *lk )   5294 static Bool thread_is_a_holder_of_Lock(Thread *thr , Lock *lk )
5295 {   5295 {
5296   UWord tmp ;   5296   UWord tmp ;
5297     5297  
5298   {   5298   {
5299   if (lk->heldBy) {   5299   if (lk->heldBy) {
5300     tmp = vgPlain_elemBag(lk->heldBy, (UWord )((Word )thr));   5300     tmp = vgPlain_elemBag(lk->heldBy, (UWord )((Word )thr));
5301     return ((Bool )(tmp > 0UL));   5301     return ((Bool )(tmp > 0UL));
5302   } else {   5302   } else {
5303     return ((Bool )0);   5303     return ((Bool )0);
5304   }   5304   }
5305 }   5305 }
5306 }   5306 }
5307 static void ( __attribute__((__noinline__)) threads__sanity_check)(Char *who )   5307 static void ( __attribute__((__noinline__)) threads__sanity_check)(Char *who )
5308 {   5308 {
5309   Char *how ;   5309   Char *how ;
5310   Thread *thr ;   5310   Thread *thr ;
5311   WordSetID wsA ;   5311   WordSetID wsA ;
5312   WordSetID wsW ;   5312   WordSetID wsW ;
5313   UWord *ls_words ;   5313   UWord *ls_words ;
5314   Word ls_size ;   5314   Word ls_size ;
5315   Word i ;   5315   Word i ;
5316   Lock *lk ;   5316   Lock *lk ;
5317   Bool tmp ;   5317   Bool tmp ;
5318   WordSet tmp___0 ;   5318   WordSet tmp___0 ;
5319   Bool tmp___1 ;   5319   Bool tmp___1 ;
5320   Bool tmp___2 ;   5320   Bool tmp___2 ;
5321     5321  
5322   {   5322   {
5323   how = (Char *)"no error";   5323   how = (Char *)"no error";
5324   thr = admin_threads;   5324   thr = admin_threads;
5325   while (thr) {   5325   while (thr) {
5326     tmp = vgHelgrind_is_sane_Thread(thr);   5326     tmp = vgHelgrind_is_sane_Thread(thr);
5327     if (tmp) {   5327     if (tmp) {
5328     5328  
5329     } else {   5329     } else {
5330       while (1) {   5330       while (1) {
5331         how = (Char *)"1";   5331         how = (Char *)"1";
5332         goto bad;   5332         goto bad;
5333         break;   5333         break;
5334       }   5334       }
5335     }   5335     }
5336     wsA = thr->locksetA;   5336     wsA = thr->locksetA;
5337     wsW = thr->locksetW;   5337     wsW = thr->locksetW;
5338     tmp___0 = vgHelgrind_isSubsetOf(univ_lsets, wsW, wsA);   5338     tmp___0 = vgHelgrind_isSubsetOf(univ_lsets, wsW, wsA);
5339     if (tmp___0) {   5339     if (tmp___0) {
5340     5340  
5341     } else {   5341     } else {
5342       while (1) {   5342       while (1) {
5343         how = (Char *)"7";   5343         how = (Char *)"7";
5344         goto bad;   5344         goto bad;
5345         break;   5345         break;
5346       }   5346       }
5347     }   5347     }
5348     vgHelgrind_getPayloadWS(& ls_words, (UWord *)(& ls_size), univ_lsets, wsA);   5348     vgHelgrind_getPayloadWS(& ls_words, (UWord *)(& ls_size), univ_lsets, wsA);
5349     i = (Word )0;   5349     i = (Word )0;
5350     while (i < ls_size) {   5350     while (i < ls_size) {
5351       lk = (Lock *)*(ls_words + i);   5351       lk = (Lock *)*(ls_words + i);
5352       tmp___1 = vgHelgrind_is_sane_LockN(lk);   5352       tmp___1 = vgHelgrind_is_sane_LockN(lk);
5353       if (tmp___1) {   5353       if (tmp___1) {
5354     5354  
5355       } else {   5355       } else {
5356         while (1) {   5356         while (1) {
5357           how = (Char *)"2";   5357           how = (Char *)"2";
5358           goto bad;   5358           goto bad;
5359           break;   5359           break;
5360         }   5360         }
5361       }   5361       }
5362       tmp___2 = thread_is_a_holder_of_Lock(thr, lk);   5362       tmp___2 = thread_is_a_holder_of_Lock(thr, lk);
5363       if (tmp___2) {   5363       if (tmp___2) {
5364     5364  
5365       } else {   5365       } else {
5366         while (1) {   5366         while (1) {
5367           how = (Char *)"3";   5367           how = (Char *)"3";
5368           goto bad;   5368           goto bad;
5369           break;   5369           break;
5370         }   5370         }
5371       }   5371       }
5372       i ++;   5372       i ++;
5373     }   5373     }
5374     thr = thr->admin;   5374     thr = thr->admin;
5375   }   5375   }
5376   return;   5376   return;
5377   bad:   5377   bad:
5378   vgPlain_printf("threads__sanity_check: who=\"%s\", bad=\"%s\"\n", who, how);   5378   vgPlain_printf("threads__sanity_check: who=\"%s\", bad=\"%s\"\n", who, how);
5379   vgPlain_assert_fail((Bool )0, (Char const   *)"0",   5379   vgPlain_assert_fail((Bool )0, (Char const   *)"0",
5380                       (Char const   *)"hg_main.c", 821,   5380                       (Char const   *)"hg_main.c", 821,
5381                       (Char const   *)"threads__sanity_check", "");   5381                       (Char const   *)"threads__sanity_check", "");
5382 }   5382 }
5383 }   5383 }
5384 static void ( __attribute__((__noinline__)) locks__sanity_check)(Char *who )   5384 static void ( __attribute__((__noinline__)) locks__sanity_check)(Char *who )
5385 {   5385 {
5386   Char *how ;   5386   Char *how ;
5387   Addr gla ;   5387   Addr gla ;
5388   Lock *lk ;   5388   Lock *lk ;
5389   Int i ;   5389   Int i ;
5390   UWord tmp ;   5390   UWord tmp ;
5391   Bool tmp___0 ;   5391   Bool tmp___0 ;
5392   Bool tmp___1 ;   5392   Bool tmp___1 ;
5393   Lock *tmp___2 ;   5393   Lock *tmp___2 ;
5394   Thread *thr ;   5394   Thread *thr ;
5395   Word count ;   5395   Word count ;
5396   Bool tmp___3 ;   5396   Bool tmp___3 ;
5397   Bool tmp___4 ;   5397   Bool tmp___4 ;
5398   Bool tmp___5 ;   5398   Bool tmp___5 ;
5399   Bool tmp___6 ;   5399   Bool tmp___6 ;
5400   Bool tmp___7 ;   5400   Bool tmp___7 ;
5401     5401  
5402   {   5402   {
5403   how = (Char *)"no error";   5403   how = (Char *)"no error";
5404   i = 0;   5404   i = 0;
5405   lk = admin_locks;   5405   lk = admin_locks;
5406   while (lk) {   5406   while (lk) {
5407     i ++;   5407     i ++;
5408     lk = lk->admin_next;   5408     lk = lk->admin_next;
5409   }   5409   }
5410   tmp = vgPlain_sizeFM(map_locks);   5410   tmp = vgPlain_sizeFM(map_locks);
5411   if ((UWord )i != tmp) {   5411   if ((UWord )i != tmp) {
5412     while (1) {   5412     while (1) {
5413       how = (Char *)"1";   5413       how = (Char *)"1";
5414       goto bad;   5414       goto bad;
5415       break;   5415       break;
5416     }   5416     }
5417   } else {   5417   } else {
5418     5418  
5419   }   5419   }
5420   vgPlain_initIterFM(map_locks);   5420   vgPlain_initIterFM(map_locks);
5421   while (1) {   5421   while (1) {
5422     tmp___0 = vgPlain_nextIterFM(map_locks, (UWord *)((Word *)(& gla)),   5422     tmp___0 = vgPlain_nextIterFM(map_locks, (UWord *)((Word *)(& gla)),
5423                                  (UWord *)((Word *)(& lk)));   5423                                  (UWord *)((Word *)(& lk)));
5424     if (tmp___0) {   5424     if (tmp___0) {
5425     5425  
5426     } else {   5426     } else {
5427       break;   5427       break;
5428     }   5428     }
5429     if (lk->guestaddr != gla) {   5429     if (lk->guestaddr != gla) {
5430       while (1) {   5430       while (1) {
5431         how = (Char *)"2";   5431         how = (Char *)"2";
5432         goto bad;   5432         goto bad;
5433         break;   5433         break;
5434       }   5434       }
5435     } else {   5435     } else {
5436     5436  
5437     }   5437     }
5438   }   5438   }
5439   vgPlain_doneIterFM(map_locks);   5439   vgPlain_doneIterFM(map_locks);
5440   lk = admin_locks;   5440   lk = admin_locks;
5441   while (lk) {   5441   while (lk) {
5442     tmp___1 = vgHelgrind_is_sane_LockN(lk);   5442     tmp___1 = vgHelgrind_is_sane_LockN(lk);
5443     if (tmp___1) {   5443     if (tmp___1) {
5444     5444  
5445     } else {   5445     } else {
5446       while (1) {   5446       while (1) {
5447         how = (Char *)"3";   5447         how = (Char *)"3";
5448         goto bad;   5448         goto bad;
5449         break;   5449         break;
5450       }   5450       }
5451     }   5451     }
5452     tmp___2 = map_locks_maybe_lookup(lk->guestaddr);   5452     tmp___2 = map_locks_maybe_lookup(lk->guestaddr);
5453     if ((unsigned int )lk != (unsigned int )tmp___2) {   5453     if ((unsigned int )lk != (unsigned int )tmp___2) {
5454       while (1) {   5454       while (1) {
5455         how = (Char *)"4";   5455         how = (Char *)"4";
5456         goto bad;   5456         goto bad;
5457         break;   5457         break;
5458       }   5458       }
5459     } else {   5459     } else {
5460     5460  
5461     }   5461     }
5462     if (lk->heldBy) {   5462     if (lk->heldBy) {
5463       vgPlain_initIterBag(lk->heldBy);   5463       vgPlain_initIterBag(lk->heldBy);
5464       while (1) {   5464       while (1) {
5465         tmp___7 = vgPlain_nextIterBag(lk->heldBy, (UWord *)((Word *)(& thr)),   5465         tmp___7 = vgPlain_nextIterBag(lk->heldBy, (UWord *)((Word *)(& thr)),
5466                                       (UWord *)(& count));   5466                                       (UWord *)(& count));
5467         if (tmp___7) {   5467         if (tmp___7) {
5468     5468  
5469         } else {   5469         } else {
5470           break;   5470           break;
5471         }   5471         }
5472         if (count >= 1L) {   5472         if (count >= 1L) {
5473     5473  
5474         } else {   5474         } else {
5475           vgPlain_assert_fail((Bool )0, (Char const   *)"count >= 1",   5475           vgPlain_assert_fail((Bool )0, (Char const   *)"count >= 1",
5476                               (Char const   *)"hg_main.c", 863,   5476                               (Char const   *)"hg_main.c", 863,
5477                               (Char const   *)"locks__sanity_check", "");   5477                               (Char const   *)"locks__sanity_check", "");
5478         }   5478         }
5479         tmp___3 = vgHelgrind_is_sane_Thread(thr);   5479         tmp___3 = vgHelgrind_is_sane_Thread(thr);
5480         if (tmp___3) {   5480         if (tmp___3) {
5481     5481  
5482         } else {   5482         } else {
5483           vgPlain_assert_fail((Bool )0,   5483           vgPlain_assert_fail((Bool )0,
5484                               (Char const   *)"HG_(is_sane_Thread)(thr)",   5484                               (Char const   *)"HG_(is_sane_Thread)(thr)",
5485                               (Char const   *)"hg_main.c", 864,   5485                               (Char const   *)"hg_main.c", 864,
5486                               (Char const   *)"locks__sanity_check", "");   5486                               (Char const   *)"locks__sanity_check", "");
5487         }   5487         }
5488         tmp___4 = vgHelgrind_elemWS(univ_lsets, thr->locksetA,   5488         tmp___4 = vgHelgrind_elemWS(univ_lsets, thr->locksetA,
5489                                     (UWord )((Word )lk));   5489                                     (UWord )((Word )lk));
5490         if (tmp___4) {   5490         if (tmp___4) {
5491     5491  
5492         } else {   5492         } else {
5493           while (1) {   5493           while (1) {
5494             how = (Char *)"6";   5494             how = (Char *)"6";
5495             goto bad;   5495             goto bad;
5496             break;   5496             break;
5497           }   5497           }
5498         }   5498         }
5499         if (lk->heldW) {   5499         if (lk->heldW) {
5500           tmp___5 = vgHelgrind_elemWS(univ_lsets, thr->locksetW,   5500           tmp___5 = vgHelgrind_elemWS(univ_lsets, thr->locksetW,
5501                                       (UWord )((Word )lk));   5501                                       (UWord )((Word )lk));
5502           if (tmp___5) {   5502           if (tmp___5) {
5503     5503  
5504           } else {   5504           } else {
5505             while (1) {   5505             while (1) {
5506               how = (Char *)"7";   5506               how = (Char *)"7";
5507               goto bad;   5507               goto bad;
5508               break;   5508               break;
5509             }   5509             }
5510           }   5510           }
5511         } else {   5511         } else {
5512     5512  
5513         }   5513         }
5514         if (! lk->heldW) {   5514         if (! lk->heldW) {
5515           tmp___6 = vgHelgrind_elemWS(univ_lsets, thr->locksetW,   5515           tmp___6 = vgHelgrind_elemWS(univ_lsets, thr->locksetW,
5516                                       (UWord )((Word )lk));   5516                                       (UWord )((Word )lk));
5517           if (tmp___6) {   5517           if (tmp___6) {
5518             while (1) {   5518             while (1) {
5519               how = (Char *)"8";   5519               how = (Char *)"8";
5520               goto bad;   5520               goto bad;
5521               break;   5521               break;
5522             }   5522             }
5523           } else {   5523           } else {
5524     5524  
5525           }   5525           }
5526         } else {   5526         } else {
5527     5527  
5528         }   5528         }
5529       }   5529       }
5530       vgPlain_doneIterBag(lk->heldBy);   5530       vgPlain_doneIterBag(lk->heldBy);
5531     } else   5531     } else
5532     if (lk->heldW) {   5532     if (lk->heldW) {
5533       while (1) {   5533       while (1) {
5534         how = (Char *)"9";   5534         how = (Char *)"9";
5535         goto bad;   5535         goto bad;
5536         break;   5536         break;
5537       }   5537       }
5538     } else {   5538     } else {
5539     5539  
5540     }   5540     }
5541     lk = lk->admin_next;   5541     lk = lk->admin_next;
5542   }   5542   }
5543   return;   5543   return;
5544   bad:   5544   bad:
5545   vgPlain_printf("locks__sanity_check: who=\"%s\", bad=\"%s\"\n", who, how);   5545   vgPlain_printf("locks__sanity_check: who=\"%s\", bad=\"%s\"\n", who, how);
5546   vgPlain_assert_fail((Bool )0, (Char const   *)"0",   5546   vgPlain_assert_fail((Bool )0, (Char const   *)"0",
5547                       (Char const   *)"hg_main.c", 887,   5547                       (Char const   *)"hg_main.c", 887,
5548                       (Char const   *)"locks__sanity_check", "");   5548                       (Char const   *)"locks__sanity_check", "");
5549 }   5549 }
5550 }   5550 }
5551 static void all_except_Locks__sanity_check(Char *who )   5551 static void all_except_Locks__sanity_check(Char *who )
5552 {   5552 {
5553     5553  
5554     5554  
5555   {   5555   {
5556   stats__sanity_checks ++;   5556   stats__sanity_checks ++;
5557   threads__sanity_check(who);   5557   threads__sanity_check(who);
5558   if (vgHelgrind_clo_track_lockorders) {   5558   if (vgHelgrind_clo_track_lockorders) {
5559     laog__sanity_check(who);   5559     laog__sanity_check(who);
5560   } else {   5560   } else {
5561     5561  
5562   }   5562   }
5563   return;   5563   return;
5564 }   5564 }
5565 }   5565 }
5566 static void all__sanity_check(Char *who )   5566 static void all__sanity_check(Char *who )
5567 {   5567 {
5568     5568  
5569     5569  
5570   {   5570   {
5571   all_except_Locks__sanity_check(who);   5571   all_except_Locks__sanity_check(who);
5572   locks__sanity_check(who);   5572   locks__sanity_check(who);
5573   return;   5573   return;
5574 }   5574 }
5575 }   5575 }
5576 static void ( __attribute__((__noinline__)) laog__pre_thread_acquires_lock)(Thread *thr ,   5576 static void ( __attribute__((__noinline__)) laog__pre_thread_acquires_lock)(Thread *thr ,
5577                                                                             Lock *lk ) ;   5577                                                                             Lock *lk ) ;
5578 __inline static Thread *get_current_Thread(void) ;   5578 __inline static Thread *get_current_Thread(void) ;
5579 static void ( __attribute__((__noinline__)) laog__handle_one_lock_deletion)(Lock *lk ) ;   5579 static void ( __attribute__((__noinline__)) laog__handle_one_lock_deletion)(Lock *lk ) ;
5580 static void shadow_mem_scopy_range(Thread *thr , Addr src , Addr dst ,   5580 static void shadow_mem_scopy_range(Thread *thr , Addr src , Addr dst ,
5581                                    SizeT len )   5581                                    SizeT len )
5582 {   5582 {
5583   Thr *hbthr ;   5583   Thr *hbthr ;
5584     5584  
5585   {   5585   {
5586   hbthr = thr->hbthr;   5586   hbthr = thr->hbthr;
5587   if (hbthr) {   5587   if (hbthr) {
5588     5588  
5589   } else {   5589   } else {
5590     vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr",   5590     vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr",
5591                         (Char const   *)"hg_main.c", 923,   5591                         (Char const   *)"hg_main.c", 923,
5592                         (Char const   *)"shadow_mem_scopy_range", "");   5592                         (Char const   *)"shadow_mem_scopy_range", "");
5593   }   5593   }
5594   libhb_copy_shadow_state(hbthr, src, dst, len);   5594   libhb_copy_shadow_state(hbthr, src, dst, len);
5595   return;   5595   return;
5596 }   5596 }
5597 }   5597 }
5598 static void shadow_mem_cread_range(Thread *thr , Addr a , SizeT len )   5598 static void shadow_mem_cread_range(Thread *thr , Addr a , SizeT len )
5599 {   5599 {
5600   Thr *hbthr ;   5600   Thr *hbthr ;
5601     5601  
5602   {   5602   {
5603   hbthr = thr->hbthr;   5603   hbthr = thr->hbthr;
5604   if (hbthr) {   5604   if (hbthr) {
5605     5605  
5606   } else {   5606   } else {
5607     vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr",   5607     vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr",
5608                         (Char const   *)"hg_main.c", 930,   5608                         (Char const   *)"hg_main.c", 930,
5609                         (Char const   *)"shadow_mem_cread_range", "");   5609                         (Char const   *)"shadow_mem_cread_range", "");
5610   }   5610   }
5611   zsm_sapplyNN_f__msmcread(hbthr, a, len);   5611   zsm_sapplyNN_f__msmcread(hbthr, a, len);
5612   return;   5612   return;
5613 }   5613 }
5614 }   5614 }
5615 static void shadow_mem_cwrite_range(Thread *thr , Addr a , SizeT len )   5615 static void shadow_mem_cwrite_range(Thread *thr , Addr a , SizeT len )
5616 {   5616 {
5617   Thr *hbthr ;   5617   Thr *hbthr ;
5618     5618  
5619   {   5619   {
5620   hbthr = thr->hbthr;   5620   hbthr = thr->hbthr;
5621   if (hbthr) {   5621   if (hbthr) {
5622     5622  
5623   } else {   5623   } else {
5624     vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr",   5624     vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr",
5625                         (Char const   *)"hg_main.c", 936,   5625                         (Char const   *)"hg_main.c", 936,
5626                         (Char const   *)"shadow_mem_cwrite_range", "");   5626                         (Char const   *)"shadow_mem_cwrite_range", "");
5627   }   5627   }
5628   zsm_sapplyNN_f__msmcwrite(hbthr, a, len);   5628   zsm_sapplyNN_f__msmcwrite(hbthr, a, len);
5629   return;   5629   return;
5630 }   5630 }
5631 }   5631 }
5632 static void shadow_mem_make_New(Thread *thr , Addr a , SizeT len )   5632 static void shadow_mem_make_New(Thread *thr , Addr a , SizeT len )
5633 {   5633 {
5634     5634  
5635     5635  
5636   {   5636   {
5637   libhb_srange_new(thr->hbthr, a, len);   5637   libhb_srange_new(thr->hbthr, a, len);
5638   return;   5638   return;
5639 }   5639 }
5640 }   5640 }
5641 static void shadow_mem_make_NoAccess(Thread *thr , Addr aIN , SizeT len )   5641 static void shadow_mem_make_NoAccess(Thread *thr , Addr aIN , SizeT len )
5642 {   5642 {
5643     5643  
5644     5644  
5645   {   5645   {
5646   libhb_srange_noaccess(thr->hbthr, aIN, len);   5646   libhb_srange_noaccess(thr->hbthr, aIN, len);
5647   return;   5647   return;
5648 }   5648 }
5649 }   5649 }
5650 static void shadow_mem_make_Untracked(Thread *thr , Addr aIN , SizeT len )   5650 static void shadow_mem_make_Untracked(Thread *thr , Addr aIN , SizeT len )
5651 {   5651 {
5652     5652  
5653     5653  
5654   {   5654   {
5655   libhb_srange_untrack(thr->hbthr, aIN, len);   5655   libhb_srange_untrack(thr->hbthr, aIN, len);
5656   return;   5656   return;
5657 }   5657 }
5658 }   5658 }
5659 static void evhH__post_thread_w_acquires_lock(Thread *thr , LockKind lkk ,   5659 static void evhH__post_thread_w_acquires_lock(Thread *thr , LockKind lkk ,
5660                                               Addr lock_ga )   5660                                               Addr lock_ga )
5661 {   5661 {
5662   Lock *lk ;   5662   Lock *lk ;
5663   Bool tmp ;   5663   Bool tmp ;
5664   ThreadId tmp___0 ;   5664   ThreadId tmp___0 ;
5665   Bool tmp___1 ;   5665   Bool tmp___1 ;
5666   UWord tmp___2 ;   5666   UWord tmp___2 ;
5667   UWord tmp___3 ;   5667   UWord tmp___3 ;
5668   Bool tmp___4 ;   5668   Bool tmp___4 ;
5669     5669  
5670   {   5670   {
5671   tmp = vgHelgrind_is_sane_Thread(thr);   5671   tmp = vgHelgrind_is_sane_Thread(thr);
5672   if (tmp) {   5672   if (tmp) {
5673     5673  
5674   } else {   5674   } else {
5675     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",   5675     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",
5676                         (Char const   *)"hg_main.c", 1010,   5676                         (Char const   *)"hg_main.c", 1010,
5677                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");   5677                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");
5678   }   5678   }
5679   tmp___0 = map_threads_reverse_lookup_SLOW(thr);   5679   tmp___0 = map_threads_reverse_lookup_SLOW(thr);
5680   lk = map_locks_lookup_or_create(lkk, lock_ga, tmp___0);   5680   lk = map_locks_lookup_or_create(lkk, lock_ga, tmp___0);
5681   tmp___1 = vgHelgrind_is_sane_LockN(lk);   5681   tmp___1 = vgHelgrind_is_sane_LockN(lk);
5682   if (tmp___1) {   5682   if (tmp___1) {
5683     5683  
5684   } else {   5684   } else {
5685     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   5685     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
5686                         (Char const   *)"hg_main.c", 1015,   5686                         (Char const   *)"hg_main.c", 1015,
5687                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");   5687                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");
5688   }   5688   }
5689   if (thr->hbthr) {   5689   if (thr->hbthr) {
5690     5690  
5691   } else {   5691   } else {
5692     vgPlain_assert_fail((Bool )0, (Char const   *)"thr->hbthr",   5692     vgPlain_assert_fail((Bool )0, (Char const   *)"thr->hbthr",
5693                         (Char const   *)"hg_main.c", 1018,   5693                         (Char const   *)"hg_main.c", 1018,
5694                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");   5694                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");
5695   }   5695   }
5696   if (lk->hbso) {   5696   if (lk->hbso) {
5697     5697  
5698   } else {   5698   } else {
5699     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->hbso",   5699     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->hbso",
5700                         (Char const   *)"hg_main.c", 1019,   5700                         (Char const   *)"hg_main.c", 1019,
5701                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");   5701                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");
5702   }   5702   }
5703   if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {   5703   if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {
5704     if (! lk->heldW) {   5704     if (! lk->heldW) {
5705     5705  
5706     } else {   5706     } else {
5707       vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldW",   5707       vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldW",
5708                           (Char const   *)"hg_main.c", 1023,   5708                           (Char const   *)"hg_main.c", 1023,
5709                           (Char const   *)"evhH__post_thread_w_acquires_lock",   5709                           (Char const   *)"evhH__post_thread_w_acquires_lock",
5710                           "");   5710                           "");
5711     }   5711     }
5712     lockN_acquire_writer(lk, thr);   5712     lockN_acquire_writer(lk, thr);
5713     libhb_so_recv(thr->hbthr, lk->hbso, (Bool )1);   5713     libhb_so_recv(thr->hbthr, lk->hbso, (Bool )1);
5714     goto noerror;   5714     goto noerror;
5715   } else {   5715   } else {
5716     5716  
5717   }   5717   }
5718   if (lk->heldBy) {   5718   if (lk->heldBy) {
5719     5719  
5720   } else {   5720   } else {
5721     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy",   5721     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy",
5722                         (Char const   *)"hg_main.c", 1032,   5722                         (Char const   *)"hg_main.c", 1032,
5723                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");   5723                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");
5724   }   5724   }
5725   if (! lk->heldW) {   5725   if (! lk->heldW) {
5726     vgHelgrind_record_error_Misc(thr,   5726     vgHelgrind_record_error_Misc(thr,
5727                                  (HChar *)"Bug in libpthread: write lock granted on rwlock which is currently rd-held");   5727                                  (HChar *)"Bug in libpthread: write lock granted on rwlock which is currently rd-held");
5728     goto error;   5728     goto error;
5729   } else {   5729   } else {
5730     5730  
5731   }   5731   }
5732   tmp___2 = vgPlain_sizeUniqueBag(lk->heldBy);   5732   tmp___2 = vgPlain_sizeUniqueBag(lk->heldBy);
5733   if (tmp___2 == 1UL) {   5733   if (tmp___2 == 1UL) {
5734     5734  
5735   } else {   5735   } else {
5736     vgPlain_assert_fail((Bool )0,   5736     vgPlain_assert_fail((Bool )0,
5737                         (Char const   *)"VG_(sizeUniqueBag)(lk->heldBy) == 1",   5737                         (Char const   *)"VG_(sizeUniqueBag)(lk->heldBy) == 1",
5738                         (Char const   *)"hg_main.c", 1042,   5738                         (Char const   *)"hg_main.c", 1042,
5739                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");   5739                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");
5740   }   5740   }
5741   tmp___3 = vgPlain_anyElementOfBag(lk->heldBy);   5741   tmp___3 = vgPlain_anyElementOfBag(lk->heldBy);
5742   if ((unsigned int )thr != (unsigned int )((Thread *)tmp___3)) {   5742   if ((unsigned int )thr != (unsigned int )((Thread *)tmp___3)) {
5743     vgHelgrind_record_error_Misc(thr,   5743     vgHelgrind_record_error_Misc(thr,
5744                                  (HChar *)"Bug in libpthread: write lock granted on mutex/rwlock which is currently wr-held by a different thread");   5744                                  (HChar *)"Bug in libpthread: write lock granted on mutex/rwlock which is currently wr-held by a different thread");
5745     goto error;   5745     goto error;
5746   } else {   5746   } else {
5747     5747  
5748   }   5748   }
5749   if ((unsigned int )lk->kind != 1001U) {   5749   if ((unsigned int )lk->kind != 1001U) {
5750     vgHelgrind_record_error_Misc(thr,   5750     vgHelgrind_record_error_Misc(thr,
5751                                  (HChar *)"Bug in libpthread: recursive write lock granted on mutex/wrlock which does not support recursion");   5751                                  (HChar *)"Bug in libpthread: recursive write lock granted on mutex/wrlock which does not support recursion");
5752     goto error;   5752     goto error;
5753   } else {   5753   } else {
5754     5754  
5755   }   5755   }
5756   lockN_acquire_writer(lk, thr);   5756   lockN_acquire_writer(lk, thr);
5757   libhb_so_recv(thr->hbthr, lk->hbso, (Bool )1);   5757   libhb_so_recv(thr->hbthr, lk->hbso, (Bool )1);
5758   goto noerror;   5758   goto noerror;
5759   noerror:   5759   noerror:
5760   if (vgHelgrind_clo_track_lockorders) {   5760   if (vgHelgrind_clo_track_lockorders) {
5761     laog__pre_thread_acquires_lock(thr, lk);   5761     laog__pre_thread_acquires_lock(thr, lk);
5762   } else {   5762   } else {
5763     5763  
5764   }   5764   }
5765   thr->locksetA = vgHelgrind_addToWS(univ_lsets, thr->locksetA,   5765   thr->locksetA = vgHelgrind_addToWS(univ_lsets, thr->locksetA,
5766                                      (UWord )((Word )lk));   5766                                      (UWord )((Word )lk));
5767   thr->locksetW = vgHelgrind_addToWS(univ_lsets, thr->locksetW,   5767   thr->locksetW = vgHelgrind_addToWS(univ_lsets, thr->locksetW,
5768                                      (UWord )((Word )lk));   5768                                      (UWord )((Word )lk));
5769   error:   5769   error:
5770   tmp___4 = vgHelgrind_is_sane_LockN(lk);   5770   tmp___4 = vgHelgrind_is_sane_LockN(lk);
5771   if (tmp___4) {   5771   if (tmp___4) {
5772     5772  
5773   } else {   5773   } else {
5774     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   5774     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
5775                         (Char const   *)"hg_main.c", 1084,   5775                         (Char const   *)"hg_main.c", 1084,
5776                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");   5776                         (Char const   *)"evhH__post_thread_w_acquires_lock", "");
5777   }   5777   }
5778   return;   5778   return;
5779 }   5779 }
5780 }   5780 }
5781 static void evhH__post_thread_r_acquires_lock(Thread *thr , LockKind lkk ,   5781 static void evhH__post_thread_r_acquires_lock(Thread *thr , LockKind lkk ,
5782                                               Addr lock_ga )   5782                                               Addr lock_ga )
5783 {   5783 {
5784   Lock *lk ;   5784   Lock *lk ;
5785   Bool tmp ;   5785   Bool tmp ;
5786   ThreadId tmp___0 ;   5786   ThreadId tmp___0 ;
5787   Bool tmp___1 ;   5787   Bool tmp___1 ;
5788   Bool tmp___2 ;   5788   Bool tmp___2 ;
5789     5789  
5790   {   5790   {
5791   tmp = vgHelgrind_is_sane_Thread(thr);   5791   tmp = vgHelgrind_is_sane_Thread(thr);
5792   if (tmp) {   5792   if (tmp) {
5793     5793  
5794   } else {   5794   } else {
5795     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",   5795     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",
5796                         (Char const   *)"hg_main.c", 1107,   5796                         (Char const   *)"hg_main.c", 1107,
5797                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");   5797                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");
5798   }   5798   }
5799   if ((unsigned int )lkk == 1003U) {   5799   if ((unsigned int )lkk == 1003U) {
5800     5800  
5801   } else {   5801   } else {
5802     vgPlain_assert_fail((Bool )0, (Char const   *)"lkk == LK_rdwr",   5802     vgPlain_assert_fail((Bool )0, (Char const   *)"lkk == LK_rdwr",
5803                         (Char const   *)"hg_main.c", 1111,   5803                         (Char const   *)"hg_main.c", 1111,
5804                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");   5804                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");
5805   }   5805   }
5806   tmp___0 = map_threads_reverse_lookup_SLOW(thr);   5806   tmp___0 = map_threads_reverse_lookup_SLOW(thr);
5807   lk = map_locks_lookup_or_create(lkk, lock_ga, tmp___0);   5807   lk = map_locks_lookup_or_create(lkk, lock_ga, tmp___0);
5808   tmp___1 = vgHelgrind_is_sane_LockN(lk);   5808   tmp___1 = vgHelgrind_is_sane_LockN(lk);
5809   if (tmp___1) {   5809   if (tmp___1) {
5810     5810  
5811   } else {   5811   } else {
5812     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   5812     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
5813                         (Char const   *)"hg_main.c", 1114,   5813                         (Char const   *)"hg_main.c", 1114,
5814                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");   5814                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");
5815   }   5815   }
5816   if (thr->hbthr) {   5816   if (thr->hbthr) {
5817     5817  
5818   } else {   5818   } else {
5819     vgPlain_assert_fail((Bool )0, (Char const   *)"thr->hbthr",   5819     vgPlain_assert_fail((Bool )0, (Char const   *)"thr->hbthr",
5820                         (Char const   *)"hg_main.c", 1117,   5820                         (Char const   *)"hg_main.c", 1117,
5821                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");   5821                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");
5822   }   5822   }
5823   if (lk->hbso) {   5823   if (lk->hbso) {
5824     5824  
5825   } else {   5825   } else {
5826     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->hbso",   5826     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->hbso",
5827                         (Char const   *)"hg_main.c", 1118,   5827                         (Char const   *)"hg_main.c", 1118,
5828                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");   5828                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");
5829   }   5829   }
5830   if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {   5830   if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {
5831     if (! lk->heldW) {   5831     if (! lk->heldW) {
5832     5832  
5833     } else {   5833     } else {
5834       vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldW",   5834       vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldW",
5835                           (Char const   *)"hg_main.c", 1122,   5835                           (Char const   *)"hg_main.c", 1122,
5836                           (Char const   *)"evhH__post_thread_r_acquires_lock",   5836                           (Char const   *)"evhH__post_thread_r_acquires_lock",
5837                           "");   5837                           "");
5838     }   5838     }
5839     lockN_acquire_reader(lk, thr);   5839     lockN_acquire_reader(lk, thr);
5840     libhb_so_recv(thr->hbthr, lk->hbso, (Bool )0);   5840     libhb_so_recv(thr->hbthr, lk->hbso, (Bool )0);
5841     goto noerror;   5841     goto noerror;
5842   } else {   5842   } else {
5843     5843  
5844   }   5844   }
5845   if (lk->heldBy) {   5845   if (lk->heldBy) {
5846     5846  
5847   } else {   5847   } else {
5848     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy",   5848     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->heldBy",
5849                         (Char const   *)"hg_main.c", 1131,   5849                         (Char const   *)"hg_main.c", 1131,
5850                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");   5850                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");
5851   }   5851   }
5852   if (lk->heldW) {   5852   if (lk->heldW) {
5853     vgHelgrind_record_error_Misc(thr,   5853     vgHelgrind_record_error_Misc(thr,
5854                                  (HChar *)"Bug in libpthread: read lock granted on rwlock which is currently wr-held");   5854                                  (HChar *)"Bug in libpthread: read lock granted on rwlock which is currently wr-held");
5855     goto error;   5855     goto error;
5856   } else {   5856   } else {
5857     5857  
5858   }   5858   }
5859   lockN_acquire_reader(lk, thr);   5859   lockN_acquire_reader(lk, thr);
5860   libhb_so_recv(thr->hbthr, lk->hbso, (Bool )0);   5860   libhb_so_recv(thr->hbthr, lk->hbso, (Bool )0);
5861   goto noerror;   5861   goto noerror;
5862   noerror:   5862   noerror:
5863   if (vgHelgrind_clo_track_lockorders) {   5863   if (vgHelgrind_clo_track_lockorders) {
5864     laog__pre_thread_acquires_lock(thr, lk);   5864     laog__pre_thread_acquires_lock(thr, lk);
5865   } else {   5865   } else {
5866     5866  
5867   }   5867   }
5868   thr->locksetA = vgHelgrind_addToWS(univ_lsets, thr->locksetA,   5868   thr->locksetA = vgHelgrind_addToWS(univ_lsets, thr->locksetA,
5869                                      (UWord )((Word )lk));   5869                                      (UWord )((Word )lk));
5870   error:   5870   error:
5871   tmp___2 = vgHelgrind_is_sane_LockN(lk);   5871   tmp___2 = vgHelgrind_is_sane_LockN(lk);
5872   if (tmp___2) {   5872   if (tmp___2) {
5873     5873  
5874   } else {   5874   } else {
5875     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   5875     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
5876                         (Char const   *)"hg_main.c", 1159,   5876                         (Char const   *)"hg_main.c", 1159,
5877                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");   5877                         (Char const   *)"evhH__post_thread_r_acquires_lock", "");
5878   }   5878   }
5879   return;   5879   return;
5880 }   5880 }
5881 }   5881 }
5882 static void evhH__pre_thread_releases_lock(Thread *thr , Addr lock_ga ,   5882 static void evhH__pre_thread_releases_lock(Thread *thr , Addr lock_ga ,
5883                                            Bool isRDWR )   5883                                            Bool isRDWR )
5884 {   5884 {
5885   Lock *lock ;   5885   Lock *lock ;
5886   Word n ;   5886   Word n ;
5887   Bool was_heldW ;   5887   Bool was_heldW ;
5888   Bool tmp ;   5888   Bool tmp ;
5889   Bool tmp___0 ;   5889   Bool tmp___0 ;
5890   Bool tmp___1 ;   5890   Bool tmp___1 ;
5891   Bool tmp___2 ;   5891   Bool tmp___2 ;
5892   UWord tmp___3 ;   5892   UWord tmp___3 ;
5893   Thread *realOwner ;   5893   Thread *realOwner ;
5894   UWord tmp___4 ;   5894   UWord tmp___4 ;
5895   Bool tmp___5 ;   5895   Bool tmp___5 ;
5896   Bool tmp___6 ;   5896   Bool tmp___6 ;
5897   Bool tmp___7 ;   5897   Bool tmp___7 ;
5898   UWord tmp___8 ;   5898   UWord tmp___8 ;
5899   Bool tmp___9 ;   5899   Bool tmp___9 ;
5900   Bool tmp___10 ;   5900   Bool tmp___10 ;
5901   Bool tmp___11 ;   5901   Bool tmp___11 ;
5902   Bool tmp___12 ;   5902   Bool tmp___12 ;
5903     5903  
5904   {   5904   {
5905   tmp = vgHelgrind_is_sane_Thread(thr);   5905   tmp = vgHelgrind_is_sane_Thread(thr);
5906   if (tmp) {   5906   if (tmp) {
5907     5907  
5908   } else {   5908   } else {
5909     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",   5909     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",
5910                         (Char const   *)"hg_main.c", 1182,   5910                         (Char const   *)"hg_main.c", 1182,
5911                         (Char const   *)"evhH__pre_thread_releases_lock", "");   5911                         (Char const   *)"evhH__pre_thread_releases_lock", "");
5912   }   5912   }
5913   lock = map_locks_maybe_lookup(lock_ga);   5913   lock = map_locks_maybe_lookup(lock_ga);
5914   if (! lock) {   5914   if (! lock) {
5915     vgHelgrind_record_error_UnlockBogus(thr, lock_ga);   5915     vgHelgrind_record_error_UnlockBogus(thr, lock_ga);
5916     return;   5916     return;
5917   } else {   5917   } else {
5918     5918  
5919   }   5919   }
5920   if (lock->guestaddr == lock_ga) {   5920   if (lock->guestaddr == lock_ga) {
5921     5921  
5922   } else {   5922   } else {
5923     vgPlain_assert_fail((Bool )0, (Char const   *)"lock->guestaddr == lock_ga",   5923     vgPlain_assert_fail((Bool )0, (Char const   *)"lock->guestaddr == lock_ga",
5924                         (Char const   *)"hg_main.c", 1193,   5924                         (Char const   *)"hg_main.c", 1193,
5925                         (Char const   *)"evhH__pre_thread_releases_lock", "");   5925                         (Char const   *)"evhH__pre_thread_releases_lock", "");
5926   }   5926   }
5927   tmp___0 = vgHelgrind_is_sane_LockN(lock);   5927   tmp___0 = vgHelgrind_is_sane_LockN(lock);
5928   if (tmp___0) {   5928   if (tmp___0) {
5929     5929  
5930   } else {   5930   } else {
5931     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lock)",   5931     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lock)",
5932                         (Char const   *)"hg_main.c", 1194,   5932                         (Char const   *)"hg_main.c", 1194,
5933                         (Char const   *)"evhH__pre_thread_releases_lock", "");   5933                         (Char const   *)"evhH__pre_thread_releases_lock", "");
5934   }   5934   }
5935   if (isRDWR) {   5935   if (isRDWR) {
5936     if ((unsigned int )lock->kind != 1003U) {   5936     if ((unsigned int )lock->kind != 1003U) {
5937       vgHelgrind_record_error_Misc(thr,   5937       vgHelgrind_record_error_Misc(thr,
5938                                    (HChar *)"pthread_rwlock_unlock with a pthread_mutex_t* argument ");   5938                                    (HChar *)"pthread_rwlock_unlock with a pthread_mutex_t* argument ");
5939     } else {   5939     } else {
5940     5940  
5941     }   5941     }
5942   } else {   5942   } else {
5943     5943  
5944   }   5944   }
5945   if (! isRDWR) {   5945   if (! isRDWR) {
5946     if ((unsigned int )lock->kind == 1003U) {   5946     if ((unsigned int )lock->kind == 1003U) {
5947       vgHelgrind_record_error_Misc(thr,   5947       vgHelgrind_record_error_Misc(thr,
5948                                    (HChar *)"pthread_mutex_unlock with a pthread_rwlock_t* argument ");   5948                                    (HChar *)"pthread_mutex_unlock with a pthread_rwlock_t* argument ");
5949     } else {   5949     } else {
5950     5950  
5951     }   5951     }
5952   } else {   5952   } else {
5953     5953  
5954   }   5954   }
5955   if (! lock->heldBy) {   5955   if (! lock->heldBy) {
5956     if (! lock->heldW) {   5956     if (! lock->heldW) {
5957     5957  
5958     } else {   5958     } else {
5959       vgPlain_assert_fail((Bool )0, (Char const   *)"!lock->heldW",   5959       vgPlain_assert_fail((Bool )0, (Char const   *)"!lock->heldW",
5960                           (Char const   *)"hg_main.c", 1208,   5960                           (Char const   *)"hg_main.c", 1208,
5961                           (Char const   *)"evhH__pre_thread_releases_lock", "");   5961                           (Char const   *)"evhH__pre_thread_releases_lock", "");
5962     }   5962     }
5963     vgHelgrind_record_error_UnlockUnlocked(thr, lock);   5963     vgHelgrind_record_error_UnlockUnlocked(thr, lock);
5964     tmp___1 = vgHelgrind_elemWS(univ_lsets, thr->locksetA, (UWord )((Word )lock));   5964     tmp___1 = vgHelgrind_elemWS(univ_lsets, thr->locksetA, (UWord )((Word )lock));
5965     if (tmp___1) {   5965     if (tmp___1) {
5966       vgPlain_assert_fail((Bool )0,   5966       vgPlain_assert_fail((Bool )0,
5967                           (Char const   *)"!HG_(elemWS)( univ_lsets, thr->locksetA, (Word)lock )",   5967                           (Char const   *)"!HG_(elemWS)( univ_lsets, thr->locksetA, (Word)lock )",
5968                           (Char const   *)"hg_main.c", 1210,   5968                           (Char const   *)"hg_main.c", 1210,
5969                           (Char const   *)"evhH__pre_thread_releases_lock", "");   5969                           (Char const   *)"evhH__pre_thread_releases_lock", "");
5970     } else {   5970     } else {
5971     5971  
5972     }   5972     }
5973     tmp___2 = vgHelgrind_elemWS(univ_lsets, thr->locksetW, (UWord )((Word )lock));   5973     tmp___2 = vgHelgrind_elemWS(univ_lsets, thr->locksetW, (UWord )((Word )lock));
5974     if (tmp___2) {   5974     if (tmp___2) {
5975       vgPlain_assert_fail((Bool )0,   5975       vgPlain_assert_fail((Bool )0,
5976                           (Char const   *)"!HG_(elemWS)( univ_lsets, thr->locksetW, (Word)lock )",   5976                           (Char const   *)"!HG_(elemWS)( univ_lsets, thr->locksetW, (Word)lock )",
5977                           (Char const   *)"hg_main.c", 1211,   5977                           (Char const   *)"hg_main.c", 1211,
5978                           (Char const   *)"evhH__pre_thread_releases_lock", "");   5978                           (Char const   *)"evhH__pre_thread_releases_lock", "");
5979     } else {   5979     } else {
5980     5980  
5981     }   5981     }
5982     goto error;   5982     goto error;
5983   } else {   5983   } else {
5984     5984  
5985   }   5985   }
5986   if (lock->heldBy) {   5986   if (lock->heldBy) {
5987     5987  
5988   } else {   5988   } else {
5989     vgPlain_assert_fail((Bool )0, (Char const   *)"lock->heldBy",   5989     vgPlain_assert_fail((Bool )0, (Char const   *)"lock->heldBy",
5990                         (Char const   *)"hg_main.c", 1216,   5990                         (Char const   *)"hg_main.c", 1216,
5991                         (Char const   *)"evhH__pre_thread_releases_lock", "");   5991                         (Char const   *)"evhH__pre_thread_releases_lock", "");
5992   }   5992   }
5993   was_heldW = lock->heldW;   5993   was_heldW = lock->heldW;
5994   tmp___3 = vgPlain_elemBag(lock->heldBy, (UWord )((Word )thr));   5994   tmp___3 = vgPlain_elemBag(lock->heldBy, (UWord )((Word )thr));
5995   n = (Word )tmp___3;   5995   n = (Word )tmp___3;
5996   if (n >= 0L) {   5996   if (n >= 0L) {
5997     5997  
5998   } else {   5998   } else {
5999     vgPlain_assert_fail((Bool )0, (Char const   *)"n >= 0",   5999     vgPlain_assert_fail((Bool )0, (Char const   *)"n >= 0",
6000                         (Char const   *)"hg_main.c", 1222,   6000                         (Char const   *)"hg_main.c", 1222,
6001                         (Char const   *)"evhH__pre_thread_releases_lock", "");   6001                         (Char const   *)"evhH__pre_thread_releases_lock", "");
6002   }   6002   }
6003   if (n == 0L) {   6003   if (n == 0L) {
6004     tmp___4 = vgPlain_anyElementOfBag(lock->heldBy);   6004     tmp___4 = vgPlain_anyElementOfBag(lock->heldBy);
6005     realOwner = (Thread *)tmp___4;   6005     realOwner = (Thread *)tmp___4;
6006     tmp___5 = vgHelgrind_is_sane_Thread(realOwner);   6006     tmp___5 = vgHelgrind_is_sane_Thread(realOwner);
6007     if (tmp___5) {   6007     if (tmp___5) {
6008     6008  
6009     } else {   6009     } else {
6010       vgPlain_assert_fail((Bool )0,   6010       vgPlain_assert_fail((Bool )0,
6011                           (Char const   *)"HG_(is_sane_Thread)(realOwner)",   6011                           (Char const   *)"HG_(is_sane_Thread)(realOwner)",
6012                           (Char const   *)"hg_main.c", 1229,   6012                           (Char const   *)"hg_main.c", 1229,
6013                           (Char const   *)"evhH__pre_thread_releases_lock", "");   6013                           (Char const   *)"evhH__pre_thread_releases_lock", "");
6014     }   6014     }
6015     if ((unsigned int )realOwner != (unsigned int )thr) {   6015     if ((unsigned int )realOwner != (unsigned int )thr) {
6016     6016  
6017     } else {   6017     } else {
6018       vgPlain_assert_fail((Bool )0, (Char const   *)"realOwner != thr",   6018       vgPlain_assert_fail((Bool )0, (Char const   *)"realOwner != thr",
6019                           (Char const   *)"hg_main.c", 1230,   6019                           (Char const   *)"hg_main.c", 1230,
6020                           (Char const   *)"evhH__pre_thread_releases_lock", "");   6020                           (Char const   *)"evhH__pre_thread_releases_lock", "");
6021     }   6021     }
6022     tmp___6 = vgHelgrind_elemWS(univ_lsets, thr->locksetA, (UWord )((Word )lock));   6022     tmp___6 = vgHelgrind_elemWS(univ_lsets, thr->locksetA, (UWord )((Word )lock));
6023     if (tmp___6) {   6023     if (tmp___6) {
6024       vgPlain_assert_fail((Bool )0,   6024       vgPlain_assert_fail((Bool )0,
6025                           (Char const   *)"!HG_(elemWS)( univ_lsets, thr->locksetA, (Word)lock )",   6025                           (Char const   *)"!HG_(elemWS)( univ_lsets, thr->locksetA, (Word)lock )",
6026                           (Char const   *)"hg_main.c", 1231,   6026                           (Char const   *)"hg_main.c", 1231,
6027                           (Char const   *)"evhH__pre_thread_releases_lock", "");   6027                           (Char const   *)"evhH__pre_thread_releases_lock", "");
6028     } else {   6028     } else {
6029     6029  
6030     }   6030     }
6031     tmp___7 = vgHelgrind_elemWS(univ_lsets, thr->locksetW, (UWord )((Word )lock));   6031     tmp___7 = vgHelgrind_elemWS(univ_lsets, thr->locksetW, (UWord )((Word )lock));
6032     if (tmp___7) {   6032     if (tmp___7) {
6033       vgPlain_assert_fail((Bool )0,   6033       vgPlain_assert_fail((Bool )0,
6034                           (Char const   *)"!HG_(elemWS)( univ_lsets, thr->locksetW, (Word)lock )",   6034                           (Char const   *)"!HG_(elemWS)( univ_lsets, thr->locksetW, (Word)lock )",
6035                           (Char const   *)"hg_main.c", 1232,   6035                           (Char const   *)"hg_main.c", 1232,
6036                           (Char const   *)"evhH__pre_thread_releases_lock", "");   6036                           (Char const   *)"evhH__pre_thread_releases_lock", "");
6037     } else {   6037     } else {
6038     6038  
6039     }   6039     }
6040     vgHelgrind_record_error_UnlockForeign(thr, realOwner, lock);   6040     vgHelgrind_record_error_UnlockForeign(thr, realOwner, lock);
6041     goto error;   6041     goto error;
6042   } else {   6042   } else {
6043     6043  
6044   }   6044   }
6045   if (n >= 1L) {   6045   if (n >= 1L) {
6046     6046  
6047   } else {   6047   } else {
6048     vgPlain_assert_fail((Bool )0, (Char const   *)"n >= 1",   6048     vgPlain_assert_fail((Bool )0, (Char const   *)"n >= 1",
6049                         (Char const   *)"hg_main.c", 1238,   6049                         (Char const   *)"hg_main.c", 1238,
6050                         (Char const   *)"evhH__pre_thread_releases_lock", "");   6050                         (Char const   *)"evhH__pre_thread_releases_lock", "");
6051   }   6051   }
6052   lockN_release(lock, thr);   6052   lockN_release(lock, thr);
6053   n --;   6053   n --;
6054   if (n >= 0L) {   6054   if (n >= 0L) {
6055     6055  
6056   } else {   6056   } else {
6057     vgPlain_assert_fail((Bool )0, (Char const   *)"n >= 0",   6057     vgPlain_assert_fail((Bool )0, (Char const   *)"n >= 0",
6058                         (Char const   *)"hg_main.c", 1243,   6058                         (Char const   *)"hg_main.c", 1243,
6059                         (Char const   *)"evhH__pre_thread_releases_lock", "");   6059                         (Char const   *)"evhH__pre_thread_releases_lock", "");
6060   }   6060   }
6061   if (n > 0L) {   6061   if (n > 0L) {
6062     if (lock->heldBy) {   6062     if (lock->heldBy) {
6063     6063  
6064     } else {   6064     } else {
6065       vgPlain_assert_fail((Bool )0, (Char const   *)"lock->heldBy",   6065       vgPlain_assert_fail((Bool )0, (Char const   *)"lock->heldBy",
6066                           (Char const   *)"hg_main.c", 1246,   6066                           (Char const   *)"hg_main.c", 1246,
6067                           (Char const   *)"evhH__pre_thread_releases_lock", "");   6067                           (Char const   *)"evhH__pre_thread_releases_lock", "");
6068     }   6068     }
6069     tmp___8 = vgPlain_elemBag(lock->heldBy, (UWord )((Word )thr));   6069     tmp___8 = vgPlain_elemBag(lock->heldBy, (UWord )((Word )thr));
6070     if ((UWord )n == tmp___8) {   6070     if ((UWord )n == tmp___8) {
6071     6071  
6072     } else {   6072     } else {
6073       vgPlain_assert_fail((Bool )0,   6073       vgPlain_assert_fail((Bool )0,
6074                           (Char const   *)"n == VG_(elemBag)( lock->heldBy, (Word)thr )",   6074                           (Char const   *)"n == VG_(elemBag)( lock->heldBy, (Word)thr )",
6075                           (Char const   *)"hg_main.c", 1247,   6075                           (Char const   *)"hg_main.c", 1247,
6076                           (Char const   *)"evhH__pre_thread_releases_lock", "");   6076                           (Char const   *)"evhH__pre_thread_releases_lock", "");
6077     }   6077     }
6078     if ((unsigned int )lock->kind == 1001U) {   6078     if ((unsigned int )lock->kind == 1001U) {
6079     6079  
6080     } else   6080     } else
6081     if ((unsigned int )lock->kind == 1003U) {   6081     if ((unsigned int )lock->kind == 1003U) {
6082       if (! lock->heldW) {   6082       if (! lock->heldW) {
6083     6083  
6084       } else {   6084       } else {
6085         vgPlain_assert_fail((Bool )0,   6085         vgPlain_assert_fail((Bool )0,
6086                             (Char const   *)"lock->kind == LK_mbRec || (lock->kind == LK_rdwr && !lock->heldW)",   6086                             (Char const   *)"lock->kind == LK_mbRec || (lock->kind == LK_rdwr && !lock->heldW)",
6087                             (Char const   *)"hg_main.c", 1251,   6087                             (Char const   *)"hg_main.c", 1251,
6088                             (Char const   *)"evhH__pre_thread_releases_lock", "");   6088                             (Char const   *)"evhH__pre_thread_releases_lock", "");
6089       }   6089       }
6090     } else {   6090     } else {
6091       vgPlain_assert_fail((Bool )0,   6091       vgPlain_assert_fail((Bool )0,
6092                           (Char const   *)"lock->kind == LK_mbRec || (lock->kind == LK_rdwr && !lock->heldW)",   6092                           (Char const   *)"lock->kind == LK_mbRec || (lock->kind == LK_rdwr && !lock->heldW)",
6093                           (Char const   *)"hg_main.c", 1251,   6093                           (Char const   *)"hg_main.c", 1251,
6094                           (Char const   *)"evhH__pre_thread_releases_lock", "");   6094                           (Char const   *)"evhH__pre_thread_releases_lock", "");
6095     }   6095     }
6096     tmp___9 = vgHelgrind_elemWS(univ_lsets, thr->locksetA, (UWord )((Word )lock));   6096     tmp___9 = vgHelgrind_elemWS(univ_lsets, thr->locksetA, (UWord )((Word )lock));
6097     if (tmp___9) {   6097     if (tmp___9) {
6098     6098  
6099     } else {   6099     } else {
6100       vgPlain_assert_fail((Bool )0,   6100       vgPlain_assert_fail((Bool )0,
6101                           (Char const   *)"HG_(elemWS)( univ_lsets, thr->locksetA, (Word)lock )",   6101                           (Char const   *)"HG_(elemWS)( univ_lsets, thr->locksetA, (Word)lock )",
6102                           (Char const   *)"hg_main.c", 1252,   6102                           (Char const   *)"hg_main.c", 1252,
6103                           (Char const   *)"evhH__pre_thread_releases_lock", "");   6103                           (Char const   *)"evhH__pre_thread_releases_lock", "");
6104     }   6104     }
6105     if (lock->heldW) {   6105     if (lock->heldW) {
6106       tmp___10 = vgHelgrind_elemWS(univ_lsets, thr->locksetW,   6106       tmp___10 = vgHelgrind_elemWS(univ_lsets, thr->locksetW,
6107                                    (UWord )((Word )lock));   6107                                    (UWord )((Word )lock));
6108       if (tmp___10) {   6108       if (tmp___10) {
6109     6109  
6110       } else {   6110       } else {
6111         vgPlain_assert_fail((Bool )0,   6111         vgPlain_assert_fail((Bool )0,
6112                             (Char const   *)"HG_(elemWS)( univ_lsets, thr->locksetW, (Word)lock )",   6112                             (Char const   *)"HG_(elemWS)( univ_lsets, thr->locksetW, (Word)lock )",
6113                             (Char const   *)"hg_main.c", 1254,   6113                             (Char const   *)"hg_main.c", 1254,
6114                             (Char const   *)"evhH__pre_thread_releases_lock", "");   6114                             (Char const   *)"evhH__pre_thread_releases_lock", "");
6115       }   6115       }
6116     } else {   6116     } else {
6117       tmp___11 = vgHelgrind_elemWS(univ_lsets, thr->locksetW,   6117       tmp___11 = vgHelgrind_elemWS(univ_lsets, thr->locksetW,
6118                                    (UWord )((Word )lock));   6118                                    (UWord )((Word )lock));
6119       if (tmp___11) {   6119       if (tmp___11) {
6120         vgPlain_assert_fail((Bool )0,   6120         vgPlain_assert_fail((Bool )0,
6121                             (Char const   *)"!HG_(elemWS)( univ_lsets, thr->locksetW, (Word)lock )",   6121                             (Char const   *)"!HG_(elemWS)( univ_lsets, thr->locksetW, (Word)lock )",
6122                             (Char const   *)"hg_main.c", 1256,   6122                             (Char const   *)"hg_main.c", 1256,
6123                             (Char const   *)"evhH__pre_thread_releases_lock", "");   6123                             (Char const   *)"evhH__pre_thread_releases_lock", "");
6124       } else {   6124       } else {
6125     6125  
6126       }   6126       }
6127     }   6127     }
6128   } else {   6128   } else {
6129     if ((unsigned int )lock->kind == 1003U) {   6129     if ((unsigned int )lock->kind == 1003U) {
6130       if (lock->heldBy) {   6130       if (lock->heldBy) {
6131         if ((int )lock->heldW == 0) {   6131         if ((int )lock->heldW == 0) {
6132     6132  
6133         } else {   6133         } else {
6134           vgPlain_assert_fail((Bool )0, (Char const   *)"lock->heldW == False",   6134           vgPlain_assert_fail((Bool )0, (Char const   *)"lock->heldW == False",
6135                               (Char const   *)"hg_main.c", 1269,   6135                               (Char const   *)"hg_main.c", 1269,
6136                               (Char const   *)"evhH__pre_thread_releases_lock",   6136                               (Char const   *)"evhH__pre_thread_releases_lock",
6137                               "");   6137                               "");
6138         }   6138         }
6139       } else {   6139       } else {
6140         goto _L;   6140         goto _L;
6141       }   6141       }
6142     } else {   6142     } else {
6143       _L: /* CIL Label */   6143       _L: /* CIL Label */
6144       if (! lock->heldBy) {   6144       if (! lock->heldBy) {
6145     6145  
6146       } else {   6146       } else {
6147         vgPlain_assert_fail((Bool )0, (Char const   *)"!lock->heldBy",   6147         vgPlain_assert_fail((Bool )0, (Char const   *)"!lock->heldBy",
6148                             (Char const   *)"hg_main.c", 1278,   6148                             (Char const   *)"hg_main.c", 1278,
6149                             (Char const   *)"evhH__pre_thread_releases_lock", "");   6149                             (Char const   *)"evhH__pre_thread_releases_lock", "");
6150       }   6150       }
6151       if ((int )lock->heldW == 0) {   6151       if ((int )lock->heldW == 0) {
6152     6152  
6153       } else {   6153       } else {
6154         vgPlain_assert_fail((Bool )0, (Char const   *)"lock->heldW == False",   6154         vgPlain_assert_fail((Bool )0, (Char const   *)"lock->heldW == False",
6155                             (Char const   *)"hg_main.c", 1279,   6155                             (Char const   *)"hg_main.c", 1279,
6156                             (Char const   *)"evhH__pre_thread_releases_lock", "");   6156                             (Char const   *)"evhH__pre_thread_releases_lock", "");
6157       }   6157       }
6158     }   6158     }
6159     thr->locksetA = vgHelgrind_delFromWS(univ_lsets, thr->locksetA,   6159     thr->locksetA = vgHelgrind_delFromWS(univ_lsets, thr->locksetA,
6160                                          (UWord )((Word )lock));   6160                                          (UWord )((Word )lock));
6161     thr->locksetW = vgHelgrind_delFromWS(univ_lsets, thr->locksetW,   6161     thr->locksetW = vgHelgrind_delFromWS(univ_lsets, thr->locksetW,
6162                                          (UWord )((Word )lock));   6162                                          (UWord )((Word )lock));
6163     if (thr->hbthr) {   6163     if (thr->hbthr) {
6164     6164  
6165     } else {   6165     } else {
6166       vgPlain_assert_fail((Bool )0, (Char const   *)"thr->hbthr",   6166       vgPlain_assert_fail((Bool )0, (Char const   *)"thr->hbthr",
6167                           (Char const   *)"hg_main.c", 1290,   6167                           (Char const   *)"hg_main.c", 1290,
6168                           (Char const   *)"evhH__pre_thread_releases_lock", "");   6168                           (Char const   *)"evhH__pre_thread_releases_lock", "");
6169     }   6169     }
6170     if (lock->hbso) {   6170     if (lock->hbso) {
6171     6171  
6172     } else {   6172     } else {
6173       vgPlain_assert_fail((Bool )0, (Char const   *)"lock->hbso",   6173       vgPlain_assert_fail((Bool )0, (Char const   *)"lock->hbso",
6174                           (Char const   *)"hg_main.c", 1291,   6174                           (Char const   *)"hg_main.c", 1291,
6175                           (Char const   *)"evhH__pre_thread_releases_lock", "");   6175                           (Char const   *)"evhH__pre_thread_releases_lock", "");
6176     }   6176     }
6177     libhb_so_send(thr->hbthr, lock->hbso, was_heldW);   6177     libhb_so_send(thr->hbthr, lock->hbso, was_heldW);
6178   }   6178   }
6179   error:   6179   error:
6180   tmp___12 = vgHelgrind_is_sane_LockN(lock);   6180   tmp___12 = vgHelgrind_is_sane_LockN(lock);
6181   if (tmp___12) {   6181   if (tmp___12) {
6182     6182  
6183   } else {   6183   } else {
6184     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lock)",   6184     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lock)",
6185                         (Char const   *)"hg_main.c", 1299,   6185                         (Char const   *)"hg_main.c", 1299,
6186                         (Char const   *)"evhH__pre_thread_releases_lock", "");   6186                         (Char const   *)"evhH__pre_thread_releases_lock", "");
6187   }   6187   }
6188   return;   6188   return;
6189 }   6189 }
6190 }   6190 }
6191 static Thread *current_Thread  =    (Thread *)((void *)0);   6191 static Thread *current_Thread  =    (Thread *)((void *)0);
6192 static Thread *current_Thread_prev  =    (Thread *)((void *)0);   6192 static Thread *current_Thread_prev  =    (Thread *)((void *)0);
6193 static void evh__start_client_code(ThreadId tid , ULong nDisp )   6193 static void evh__start_client_code(ThreadId tid , ULong nDisp )
6194 {   6194 {
6195     6195  
6196     6196  
6197   {   6197   {
6198   if ((unsigned int )current_Thread == (unsigned int )((void *)0)) {   6198   if ((unsigned int )current_Thread == (unsigned int )((void *)0)) {
6199     6199  
6200   } else {   6200   } else {
6201     vgPlain_assert_fail((Bool )0, (Char const   *)"current_Thread == NULL",   6201     vgPlain_assert_fail((Bool )0, (Char const   *)"current_Thread == NULL",
6202                         (Char const   *)"hg_main.c", 1328,   6202                         (Char const   *)"hg_main.c", 1328,
6203                         (Char const   *)"evh__start_client_code", "");   6203                         (Char const   *)"evh__start_client_code", "");
6204   }   6204   }
6205   current_Thread = map_threads_lookup(tid);   6205   current_Thread = map_threads_lookup(tid);
6206   if ((unsigned int )current_Thread != (unsigned int )((void *)0)) {   6206   if ((unsigned int )current_Thread != (unsigned int )((void *)0)) {
6207     6207  
6208   } else {   6208   } else {
6209     vgPlain_assert_fail((Bool )0, (Char const   *)"current_Thread != NULL",   6209     vgPlain_assert_fail((Bool )0, (Char const   *)"current_Thread != NULL",
6210                         (Char const   *)"hg_main.c", 1330,   6210                         (Char const   *)"hg_main.c", 1330,
6211                         (Char const   *)"evh__start_client_code", "");   6211                         (Char const   *)"evh__start_client_code", "");
6212   }   6212   }
6213   if ((unsigned int )current_Thread != (unsigned int )current_Thread_prev) {   6213   if ((unsigned int )current_Thread != (unsigned int )current_Thread_prev) {
6214     libhb_Thr_resumes(current_Thread->hbthr);   6214     libhb_Thr_resumes(current_Thread->hbthr);
6215     current_Thread_prev = current_Thread;   6215     current_Thread_prev = current_Thread;
6216   } else {   6216   } else {
6217     6217  
6218   }   6218   }
6219   return;   6219   return;
6220 }   6220 }
6221 }   6221 }
6222 static void evh__stop_client_code(ThreadId tid , ULong nDisp )   6222 static void evh__stop_client_code(ThreadId tid , ULong nDisp )
6223 {   6223 {
6224     6224  
6225     6225  
6226   {   6226   {
6227   if ((unsigned int )current_Thread != (unsigned int )((void *)0)) {   6227   if ((unsigned int )current_Thread != (unsigned int )((void *)0)) {
6228     6228  
6229   } else {   6229   } else {
6230     vgPlain_assert_fail((Bool )0, (Char const   *)"current_Thread != NULL",   6230     vgPlain_assert_fail((Bool )0, (Char const   *)"current_Thread != NULL",
6231                         (Char const   *)"hg_main.c", 1338,   6231                         (Char const   *)"hg_main.c", 1338,
6232                         (Char const   *)"evh__stop_client_code", "");   6232                         (Char const   *)"evh__stop_client_code", "");
6233   }   6233   }
6234   current_Thread = (Thread *)((void *)0);   6234   current_Thread = (Thread *)((void *)0);
6235   libhb_maybe_GC();   6235   libhb_maybe_GC();
6236   return;   6236   return;
6237 }   6237 }
6238 }   6238 }
6239 __inline static Thread *get_current_Thread_in_C_C(void)   6239 __inline static Thread *get_current_Thread_in_C_C(void)
6240 {   6240 {
6241     6241  
6242     6242  
6243   {   6243   {
6244   return (current_Thread);   6244   return (current_Thread);
6245 }   6245 }
6246 }   6246 }
6247 __inline static Thread *get_current_Thread(void)   6247 __inline static Thread *get_current_Thread(void)
6248 {   6248 {
6249   ThreadId coretid ;   6249   ThreadId coretid ;
6250   Thread *thr ;   6250   Thread *thr ;
6251   long tmp ;   6251   long tmp ;
6252     6252  
6253   {   6253   {
6254   thr = get_current_Thread_in_C_C();   6254   thr = get_current_Thread_in_C_C();
6255   tmp = __builtin_expect((long )(! (! thr)), 1L);   6255   tmp = __builtin_expect((long )(! (! thr)), 1L);
6256   if (tmp) {   6256   if (tmp) {
6257     return (thr);   6257     return (thr);
6258   } else {   6258   } else {
6259     6259  
6260   }   6260   }
6261   coretid = vgPlain_get_running_tid();   6261   coretid = vgPlain_get_running_tid();
6262   if (coretid == 0U) {   6262   if (coretid == 0U) {
6263     coretid = (ThreadId )1;   6263     coretid = (ThreadId )1;
6264   } else {   6264   } else {
6265     6265  
6266   }   6266   }
6267   thr = map_threads_lookup(coretid);   6267   thr = map_threads_lookup(coretid);
6268   return (thr);   6268   return (thr);
6269 }   6269 }
6270 }   6270 }
6271 static void evh__new_mem(Addr a , SizeT len )   6271 static void evh__new_mem(Addr a , SizeT len )
6272 {   6272 {
6273   Thread *tmp ;   6273   Thread *tmp ;
6274     6274  
6275   {   6275   {
6276   tmp = get_current_Thread();   6276   tmp = get_current_Thread();
6277   shadow_mem_make_New(tmp, a, len);   6277   shadow_mem_make_New(tmp, a, len);
6278   if (len >= 256UL) {   6278   if (len >= 256UL) {
6279     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6279     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6280       all__sanity_check((Char *)"evh__new_mem-post");   6280       all__sanity_check((Char *)"evh__new_mem-post");
6281     } else {   6281     } else {
6282     6282  
6283     }   6283     }
6284   } else {   6284   } else {
6285     6285  
6286   }   6286   }
6287   return;   6287   return;
6288 }   6288 }
6289 }   6289 }
6290 static void evh__new_mem_stack(Addr a , SizeT len )   6290 static void evh__new_mem_stack(Addr a , SizeT len )
6291 {   6291 {
6292   Thread *tmp ;   6292   Thread *tmp ;
6293     6293  
6294   {   6294   {
6295   tmp = get_current_Thread();   6295   tmp = get_current_Thread();
6296   shadow_mem_make_New(tmp, a, len);   6296   shadow_mem_make_New(tmp, a, len);
6297   if (len >= 256UL) {   6297   if (len >= 256UL) {
6298     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6298     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6299       all__sanity_check((Char *)"evh__new_mem_stack-post");   6299       all__sanity_check((Char *)"evh__new_mem_stack-post");
6300     } else {   6300     } else {
6301     6301  
6302     }   6302     }
6303   } else {   6303   } else {
6304     6304  
6305   }   6305   }
6306   return;   6306   return;
6307 }   6307 }
6308 }   6308 }
6309 static void evh__new_mem_w_tid(Addr a , SizeT len , ThreadId tid )   6309 static void evh__new_mem_w_tid(Addr a , SizeT len , ThreadId tid )
6310 {   6310 {
6311   Thread *tmp ;   6311   Thread *tmp ;
6312     6312  
6313   {   6313   {
6314   tmp = get_current_Thread();   6314   tmp = get_current_Thread();
6315   shadow_mem_make_New(tmp, a, len);   6315   shadow_mem_make_New(tmp, a, len);
6316   if (len >= 256UL) {   6316   if (len >= 256UL) {
6317     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6317     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6318       all__sanity_check((Char *)"evh__new_mem_w_tid-post");   6318       all__sanity_check((Char *)"evh__new_mem_w_tid-post");
6319     } else {   6319     } else {
6320     6320  
6321     }   6321     }
6322   } else {   6322   } else {
6323     6323  
6324   }   6324   }
6325   return;   6325   return;
6326 }   6326 }
6327 }   6327 }
6328 static void evh__new_mem_w_perms(Addr a , SizeT len , Bool rr , Bool ww ,   6328 static void evh__new_mem_w_perms(Addr a , SizeT len , Bool rr , Bool ww ,
6329                                  Bool xx , ULong di_handle )   6329                                  Bool xx , ULong di_handle )
6330 {   6330 {
6331   Thread *tmp ;   6331   Thread *tmp ;
6332     6332  
6333   {   6333   {
6334   if (rr) {   6334   if (rr) {
6335     tmp = get_current_Thread();   6335     tmp = get_current_Thread();
6336     shadow_mem_make_New(tmp, a, len);   6336     shadow_mem_make_New(tmp, a, len);
6337   } else   6337   } else
6338   if (ww) {   6338   if (ww) {
6339     tmp = get_current_Thread();   6339     tmp = get_current_Thread();
6340     shadow_mem_make_New(tmp, a, len);   6340     shadow_mem_make_New(tmp, a, len);
6341   } else   6341   } else
6342   if (xx) {   6342   if (xx) {
6343     tmp = get_current_Thread();   6343     tmp = get_current_Thread();
6344     shadow_mem_make_New(tmp, a, len);   6344     shadow_mem_make_New(tmp, a, len);
6345   } else {   6345   } else {
6346     6346  
6347   }   6347   }
6348   if (len >= 256UL) {   6348   if (len >= 256UL) {
6349     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6349     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6350       all__sanity_check((Char *)"evh__new_mem_w_perms-post");   6350       all__sanity_check((Char *)"evh__new_mem_w_perms-post");
6351     } else {   6351     } else {
6352     6352  
6353     }   6353     }
6354   } else {   6354   } else {
6355     6355  
6356   }   6356   }
6357   return;   6357   return;
6358 }   6358 }
6359 }   6359 }
6360 static void evh__set_perms(Addr a , SizeT len , Bool rr , Bool ww , Bool xx )   6360 static void evh__set_perms(Addr a , SizeT len , Bool rr , Bool ww , Bool xx )
6361 {   6361 {
6362   Thread *tmp ;   6362   Thread *tmp ;
6363     6363  
6364   {   6364   {
6365   if (rr) {   6365   if (rr) {
6366     6366  
6367   } else   6367   } else
6368   if (ww) {   6368   if (ww) {
6369     6369  
6370   } else {   6370   } else {
6371     tmp = get_current_Thread();   6371     tmp = get_current_Thread();
6372     shadow_mem_make_NoAccess(tmp, a, len);   6372     shadow_mem_make_NoAccess(tmp, a, len);
6373   }   6373   }
6374   if (len >= 256UL) {   6374   if (len >= 256UL) {
6375     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6375     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6376       all__sanity_check((Char *)"evh__set_perms-post");   6376       all__sanity_check((Char *)"evh__set_perms-post");
6377     } else {   6377     } else {
6378     6378  
6379     }   6379     }
6380   } else {   6380   } else {
6381     6381  
6382   }   6382   }
6383   return;   6383   return;
6384 }   6384 }
6385 }   6385 }
6386 static void evh__die_mem(Addr a , SizeT len )   6386 static void evh__die_mem(Addr a , SizeT len )
6387 {   6387 {
6388   Thread *tmp ;   6388   Thread *tmp ;
6389     6389  
6390   {   6390   {
6391   tmp = get_current_Thread();   6391   tmp = get_current_Thread();
6392   shadow_mem_make_NoAccess(tmp, a, len);   6392   shadow_mem_make_NoAccess(tmp, a, len);
6393   if (len >= 256UL) {   6393   if (len >= 256UL) {
6394     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6394     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6395       all__sanity_check((Char *)"evh__die_mem-post");   6395       all__sanity_check((Char *)"evh__die_mem-post");
6396     } else {   6396     } else {
6397     6397  
6398     }   6398     }
6399   } else {   6399   } else {
6400     6400  
6401   }   6401   }
6402   return;   6402   return;
6403 }   6403 }
6404 }   6404 }
6405 static void evh__untrack_mem(Addr a , SizeT len )   6405 static void evh__untrack_mem(Addr a , SizeT len )
6406 {   6406 {
6407   Thread *tmp ;   6407   Thread *tmp ;
6408     6408  
6409   {   6409   {
6410   tmp = get_current_Thread();   6410   tmp = get_current_Thread();
6411   shadow_mem_make_Untracked(tmp, a, len);   6411   shadow_mem_make_Untracked(tmp, a, len);
6412   if (len >= 256UL) {   6412   if (len >= 256UL) {
6413     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6413     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6414       all__sanity_check((Char *)"evh__untrack_mem-post");   6414       all__sanity_check((Char *)"evh__untrack_mem-post");
6415     } else {   6415     } else {
6416     6416  
6417     }   6417     }
6418   } else {   6418   } else {
6419     6419  
6420   }   6420   }
6421   return;   6421   return;
6422 }   6422 }
6423 }   6423 }
6424 static void evh__copy_mem(Addr src , Addr dst , SizeT len )   6424 static void evh__copy_mem(Addr src , Addr dst , SizeT len )
6425 {   6425 {
6426   Thread *tmp ;   6426   Thread *tmp ;
6427     6427  
6428   {   6428   {
6429   tmp = get_current_Thread();   6429   tmp = get_current_Thread();
6430   shadow_mem_scopy_range(tmp, src, dst, len);   6430   shadow_mem_scopy_range(tmp, src, dst, len);
6431   if (len >= 256UL) {   6431   if (len >= 256UL) {
6432     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6432     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6433       all__sanity_check((Char *)"evh__copy_mem-post");   6433       all__sanity_check((Char *)"evh__copy_mem-post");
6434     } else {   6434     } else {
6435     6435  
6436     }   6436     }
6437   } else {   6437   } else {
6438     6438  
6439   }   6439   }
6440   return;   6440   return;
6441 }   6441 }
6442 }   6442 }
6443 static void evh__pre_thread_ll_create(ThreadId parent , ThreadId child )   6443 static void evh__pre_thread_ll_create(ThreadId parent , ThreadId child )
6444 {   6444 {
6445   Thread *thr_p ;   6445   Thread *thr_p ;
6446   Thread *thr_c ;   6446   Thread *thr_c ;
6447   Thr *hbthr_p ;   6447   Thr *hbthr_p ;
6448   Thr *hbthr_c ;   6448   Thr *hbthr_c ;
6449   Bool tmp ;   6449   Bool tmp ;
6450   Bool tmp___0 ;   6450   Bool tmp___0 ;
6451   Thread *tmp___1 ;   6451   Thread *tmp___1 ;
6452   Thread *tmp___2 ;   6452   Thread *tmp___2 ;
6453   Word first_ip_delta ;   6453   Word first_ip_delta ;
6454     6454  
6455   {   6455   {
6456   if (parent != 0U) {   6456   if (parent != 0U) {
6457     tmp = vgHelgrind_is_sane_ThreadId(parent);   6457     tmp = vgHelgrind_is_sane_ThreadId(parent);
6458     if (tmp) {   6458     if (tmp) {
6459     6459  
6460     } else {   6460     } else {
6461       vgPlain_assert_fail((Bool )0,   6461       vgPlain_assert_fail((Bool )0,
6462                           (Char const   *)"HG_(is_sane_ThreadId)(parent)",   6462                           (Char const   *)"HG_(is_sane_ThreadId)(parent)",
6463                           (Char const   *)"hg_main.c", 1460,   6463                           (Char const   *)"hg_main.c", 1460,
6464                           (Char const   *)"evh__pre_thread_ll_create", "");   6464                           (Char const   *)"evh__pre_thread_ll_create", "");
6465     }   6465     }
6466     tmp___0 = vgHelgrind_is_sane_ThreadId(child);   6466     tmp___0 = vgHelgrind_is_sane_ThreadId(child);
6467     if (tmp___0) {   6467     if (tmp___0) {
6468     6468  
6469     } else {   6469     } else {
6470       vgPlain_assert_fail((Bool )0,   6470       vgPlain_assert_fail((Bool )0,
6471                           (Char const   *)"HG_(is_sane_ThreadId)(child)",   6471                           (Char const   *)"HG_(is_sane_ThreadId)(child)",
6472                           (Char const   *)"hg_main.c", 1461,   6472                           (Char const   *)"hg_main.c", 1461,
6473                           (Char const   *)"evh__pre_thread_ll_create", "");   6473                           (Char const   *)"evh__pre_thread_ll_create", "");
6474     }   6474     }
6475     if (parent != child) {   6475     if (parent != child) {
6476     6476  
6477     } else {   6477     } else {
6478       vgPlain_assert_fail((Bool )0, (Char const   *)"parent != child",   6478       vgPlain_assert_fail((Bool )0, (Char const   *)"parent != child",
6479                           (Char const   *)"hg_main.c", 1462,   6479                           (Char const   *)"hg_main.c", 1462,
6480                           (Char const   *)"evh__pre_thread_ll_create", "");   6480                           (Char const   *)"evh__pre_thread_ll_create", "");
6481     }   6481     }
6482     thr_p = map_threads_maybe_lookup(parent);   6482     thr_p = map_threads_maybe_lookup(parent);
6483     thr_c = map_threads_maybe_lookup(child);   6483     thr_c = map_threads_maybe_lookup(child);
6484     if ((unsigned int )thr_p != (unsigned int )((void *)0)) {   6484     if ((unsigned int )thr_p != (unsigned int )((void *)0)) {
6485     6485  
6486     } else {   6486     } else {
6487       vgPlain_assert_fail((Bool )0, (Char const   *)"thr_p != NULL",   6487       vgPlain_assert_fail((Bool )0, (Char const   *)"thr_p != NULL",
6488                           (Char const   *)"hg_main.c", 1467,   6488                           (Char const   *)"hg_main.c", 1467,
6489                           (Char const   *)"evh__pre_thread_ll_create", "");   6489                           (Char const   *)"evh__pre_thread_ll_create", "");
6490     }   6490     }
6491     if ((unsigned int )thr_c == (unsigned int )((void *)0)) {   6491     if ((unsigned int )thr_c == (unsigned int )((void *)0)) {
6492     6492  
6493     } else {   6493     } else {
6494       vgPlain_assert_fail((Bool )0, (Char const   *)"thr_c == NULL",   6494       vgPlain_assert_fail((Bool )0, (Char const   *)"thr_c == NULL",
6495                           (Char const   *)"hg_main.c", 1468,   6495                           (Char const   *)"hg_main.c", 1468,
6496                           (Char const   *)"evh__pre_thread_ll_create", "");   6496                           (Char const   *)"evh__pre_thread_ll_create", "");
6497     }   6497     }
6498     hbthr_p = thr_p->hbthr;   6498     hbthr_p = thr_p->hbthr;
6499     if ((unsigned int )hbthr_p != (unsigned int )((void *)0)) {   6499     if ((unsigned int )hbthr_p != (unsigned int )((void *)0)) {
6500     6500  
6501     } else {   6501     } else {
6502       vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr_p != NULL",   6502       vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr_p != NULL",
6503                           (Char const   *)"hg_main.c", 1471,   6503                           (Char const   *)"hg_main.c", 1471,
6504                           (Char const   *)"evh__pre_thread_ll_create", "");   6504                           (Char const   *)"evh__pre_thread_ll_create", "");
6505     }   6505     }
6506     tmp___1 = libhb_get_Thr_hgthread(hbthr_p);   6506     tmp___1 = libhb_get_Thr_hgthread(hbthr_p);
6507     if ((unsigned int )tmp___1 == (unsigned int )thr_p) {   6507     if ((unsigned int )tmp___1 == (unsigned int )thr_p) {
6508     6508  
6509     } else {   6509     } else {
6510       vgPlain_assert_fail((Bool )0,   6510       vgPlain_assert_fail((Bool )0,
6511                           (Char const   *)"libhb_get_Thr_hgthread(hbthr_p) == thr_p",   6511                           (Char const   *)"libhb_get_Thr_hgthread(hbthr_p) == thr_p",
6512                           (Char const   *)"hg_main.c", 1472,   6512                           (Char const   *)"hg_main.c", 1472,
6513                           (Char const   *)"evh__pre_thread_ll_create", "");   6513                           (Char const   *)"evh__pre_thread_ll_create", "");
6514     }   6514     }
6515     hbthr_c = libhb_create(hbthr_p);   6515     hbthr_c = libhb_create(hbthr_p);
6516     thr_c = mk_Thread(hbthr_c);   6516     thr_c = mk_Thread(hbthr_c);
6517     tmp___2 = libhb_get_Thr_hgthread(hbthr_c);   6517     tmp___2 = libhb_get_Thr_hgthread(hbthr_c);
6518     if ((unsigned int )tmp___2 == (unsigned int )((void *)0)) {   6518     if ((unsigned int )tmp___2 == (unsigned int )((void *)0)) {
6519     6519  
6520     } else {   6520     } else {
6521       vgPlain_assert_fail((Bool )0,   6521       vgPlain_assert_fail((Bool )0,
6522                           (Char const   *)"libhb_get_Thr_hgthread(hbthr_c) == NULL",   6522                           (Char const   *)"libhb_get_Thr_hgthread(hbthr_c) == NULL",
6523                           (Char const   *)"hg_main.c", 1479,   6523                           (Char const   *)"hg_main.c", 1479,
6524                           (Char const   *)"evh__pre_thread_ll_create", "");   6524                           (Char const   *)"evh__pre_thread_ll_create", "");
6525     }   6525     }
6526     libhb_set_Thr_hgthread(hbthr_c, thr_c);   6526     libhb_set_Thr_hgthread(hbthr_c, thr_c);
6527     *(map_threads + child) = thr_c;   6527     *(map_threads + child) = thr_c;
6528     if (thr_c->coretid == 0U) {   6528     if (thr_c->coretid == 0U) {
6529     6529  
6530     } else {   6530     } else {
6531       vgPlain_assert_fail((Bool )0,   6531       vgPlain_assert_fail((Bool )0,
6532                           (Char const   *)"thr_c->coretid == VG_INVALID_THREADID",   6532                           (Char const   *)"thr_c->coretid == VG_INVALID_THREADID",
6533                           (Char const   *)"hg_main.c", 1484,   6533                           (Char const   *)"hg_main.c", 1484,
6534                           (Char const   *)"evh__pre_thread_ll_create", "");   6534                           (Char const   *)"evh__pre_thread_ll_create", "");
6535     }   6535     }
6536     thr_c->coretid = child;   6536     thr_c->coretid = child;
6537     first_ip_delta = (Word )0;   6537     first_ip_delta = (Word )0;
6538     thr_c->created_at = vgPlain_record_ExeContext(parent, first_ip_delta);   6538     thr_c->created_at = vgPlain_record_ExeContext(parent, first_ip_delta);
6539   } else {   6539   } else {
6540     6540  
6541   }   6541   }
6542   if (vgHelgrind_clo_sanity_flags & 1L) {   6542   if (vgHelgrind_clo_sanity_flags & 1L) {
6543     all__sanity_check((Char *)"evh__pre_thread_create-post");   6543     all__sanity_check((Char *)"evh__pre_thread_create-post");
6544   } else {   6544   } else {
6545     6545  
6546   }   6546   }
6547   return;   6547   return;
6548 }   6548 }
6549 }   6549 }
6550 static void evh__pre_thread_ll_exit(ThreadId quit_tid )   6550 static void evh__pre_thread_ll_exit(ThreadId quit_tid )
6551 {   6551 {
6552   Int nHeld ;   6552   Int nHeld ;
6553   Thread *thr_q ;   6553   Thread *thr_q ;
6554   Bool tmp ;   6554   Bool tmp ;
6555   UWord tmp___0 ;   6555   UWord tmp___0 ;
6556   HChar buf[80] ;   6556   HChar buf[80] ;
6557   char const   *tmp___1 ;   6557   char const   *tmp___1 ;
6558     6558  
6559   {   6559   {
6560   tmp = vgHelgrind_is_sane_ThreadId(quit_tid);   6560   tmp = vgHelgrind_is_sane_ThreadId(quit_tid);
6561   if (tmp) {   6561   if (tmp) {
6562     6562  
6563   } else {   6563   } else {
6564     vgPlain_assert_fail((Bool )0,   6564     vgPlain_assert_fail((Bool )0,
6565                         (Char const   *)"HG_(is_sane_ThreadId)(quit_tid)",   6565                         (Char const   *)"HG_(is_sane_ThreadId)(quit_tid)",
6566                         (Char const   *)"hg_main.c", 1533,   6566                         (Char const   *)"hg_main.c", 1533,
6567                         (Char const   *)"evh__pre_thread_ll_exit", "");   6567                         (Char const   *)"evh__pre_thread_ll_exit", "");
6568   }   6568   }
6569   thr_q = map_threads_maybe_lookup(quit_tid);   6569   thr_q = map_threads_maybe_lookup(quit_tid);
6570   if ((unsigned int )thr_q != (unsigned int )((void *)0)) {   6570   if ((unsigned int )thr_q != (unsigned int )((void *)0)) {
6571     6571  
6572   } else {   6572   } else {
6573     vgPlain_assert_fail((Bool )0, (Char const   *)"thr_q != NULL",   6573     vgPlain_assert_fail((Bool )0, (Char const   *)"thr_q != NULL",
6574                         (Char const   *)"hg_main.c", 1535,   6574                         (Char const   *)"hg_main.c", 1535,
6575                         (Char const   *)"evh__pre_thread_ll_exit", "");   6575                         (Char const   *)"evh__pre_thread_ll_exit", "");
6576   }   6576   }
6577   tmp___0 = vgHelgrind_cardinalityWS(univ_lsets, thr_q->locksetA);   6577   tmp___0 = vgHelgrind_cardinalityWS(univ_lsets, thr_q->locksetA);
6578   nHeld = (Int )tmp___0;   6578   nHeld = (Int )tmp___0;
6579   if (nHeld >= 0) {   6579   if (nHeld >= 0) {
6580     6580  
6581   } else {   6581   } else {
6582     vgPlain_assert_fail((Bool )0, (Char const   *)"nHeld >= 0",   6582     vgPlain_assert_fail((Bool )0, (Char const   *)"nHeld >= 0",
6583                         (Char const   *)"hg_main.c", 1539,   6583                         (Char const   *)"hg_main.c", 1539,
6584                         (Char const   *)"evh__pre_thread_ll_exit", "");   6584                         (Char const   *)"evh__pre_thread_ll_exit", "");
6585   }   6585   }
6586   if (nHeld > 0) {   6586   if (nHeld > 0) {
6587     if (nHeld > 1) {   6587     if (nHeld > 1) {
6588       tmp___1 = "s";   6588       tmp___1 = "s";
6589     } else {   6589     } else {
6590       tmp___1 = "";   6590       tmp___1 = "";
6591     }   6591     }
6592     vgPlain_sprintf((Char *)(buf), "Exiting thread still holds %d lock%s",   6592     vgPlain_sprintf((Char *)(buf), "Exiting thread still holds %d lock%s",
6593                     nHeld, tmp___1);   6593                     nHeld, tmp___1);
6594     vgHelgrind_record_error_Misc(thr_q, buf);   6594     vgHelgrind_record_error_Misc(thr_q, buf);
6595   } else {   6595   } else {
6596     6596  
6597   }   6597   }
6598   if (thr_q->hbthr) {   6598   if (thr_q->hbthr) {
6599     6599  
6600   } else {   6600   } else {
6601     vgPlain_assert_fail((Bool )0, (Char const   *)"thr_q->hbthr",   6601     vgPlain_assert_fail((Bool )0, (Char const   *)"thr_q->hbthr",
6602                         (Char const   *)"hg_main.c", 1553,   6602                         (Char const   *)"hg_main.c", 1553,
6603                         (Char const   *)"evh__pre_thread_ll_exit", "");   6603                         (Char const   *)"evh__pre_thread_ll_exit", "");
6604   }   6604   }
6605   libhb_async_exit(thr_q->hbthr);   6605   libhb_async_exit(thr_q->hbthr);
6606   if (thr_q->coretid == quit_tid) {   6606   if (thr_q->coretid == quit_tid) {
6607     6607  
6608   } else {   6608   } else {
6609     vgPlain_assert_fail((Bool )0, (Char const   *)"thr_q->coretid == quit_tid",   6609     vgPlain_assert_fail((Bool )0, (Char const   *)"thr_q->coretid == quit_tid",
6610                         (Char const   *)"hg_main.c", 1555,   6610                         (Char const   *)"hg_main.c", 1555,
6611                         (Char const   *)"evh__pre_thread_ll_exit", "");   6611                         (Char const   *)"evh__pre_thread_ll_exit", "");
6612   }   6612   }
6613   thr_q->coretid = (ThreadId )0;   6613   thr_q->coretid = (ThreadId )0;
6614   map_threads_delete(quit_tid);   6614   map_threads_delete(quit_tid);
6615   if (vgHelgrind_clo_sanity_flags & 1L) {   6615   if (vgHelgrind_clo_sanity_flags & 1L) {
6616     all__sanity_check((Char *)"evh__pre_thread_ll_exit-post");   6616     all__sanity_check((Char *)"evh__pre_thread_ll_exit-post");
6617   } else {   6617   } else {
6618     6618  
6619   }   6619   }
6620   return;   6620   return;
6621 }   6621 }
6622 }   6622 }
6623 static void evh__atfork_child(ThreadId tid )   6623 static void evh__atfork_child(ThreadId tid )
6624 {   6624 {
6625   UInt i ;   6625   UInt i ;
6626   Thread *thr ;   6626   Thread *thr ;
6627     6627  
6628   {   6628   {
6629   thr = map_threads_maybe_lookup((ThreadId )0);   6629   thr = map_threads_maybe_lookup((ThreadId )0);
6630   if (! thr) {   6630   if (! thr) {
6631     6631  
6632   } else {   6632   } else {
6633     vgPlain_assert_fail((Bool )0, (Char const   *)"!thr",   6633     vgPlain_assert_fail((Bool )0, (Char const   *)"!thr",
6634                         (Char const   *)"hg_main.c", 1574,   6634                         (Char const   *)"hg_main.c", 1574,
6635                         (Char const   *)"evh__atfork_child", "");   6635                         (Char const   *)"evh__atfork_child", "");
6636   }   6636   }
6637   i = (UInt )1;   6637   i = (UInt )1;
6638   while (i < 500U) {   6638   while (i < 500U) {
6639     if (i == tid) {   6639     if (i == tid) {
6640       goto __Cont;   6640       goto __Cont;
6641     } else {   6641     } else {
6642     6642  
6643     }   6643     }
6644     thr = map_threads_maybe_lookup(i);   6644     thr = map_threads_maybe_lookup(i);
6645     if (! thr) {   6645     if (! thr) {
6646       goto __Cont;   6646       goto __Cont;
6647     } else {   6647     } else {
6648     6648  
6649     }   6649     }
6650     if (thr->hbthr) {   6650     if (thr->hbthr) {
6651     6651  
6652     } else {   6652     } else {
6653       vgPlain_assert_fail((Bool )0, (Char const   *)"thr->hbthr",   6653       vgPlain_assert_fail((Bool )0, (Char const   *)"thr->hbthr",
6654                           (Char const   *)"hg_main.c", 1584,   6654                           (Char const   *)"hg_main.c", 1584,
6655                           (Char const   *)"evh__atfork_child", "");   6655                           (Char const   *)"evh__atfork_child", "");
6656     }   6656     }
6657     libhb_async_exit(thr->hbthr);   6657     libhb_async_exit(thr->hbthr);
6658     if (thr->coretid == i) {   6658     if (thr->coretid == i) {
6659     6659  
6660     } else {   6660     } else {
6661       vgPlain_assert_fail((Bool )0, (Char const   *)"thr->coretid == i",   6661       vgPlain_assert_fail((Bool )0, (Char const   *)"thr->coretid == i",
6662                           (Char const   *)"hg_main.c", 1586,   6662                           (Char const   *)"hg_main.c", 1586,
6663                           (Char const   *)"evh__atfork_child", "");   6663                           (Char const   *)"evh__atfork_child", "");
6664     }   6664     }
6665     thr->coretid = (ThreadId )0;   6665     thr->coretid = (ThreadId )0;
6666     map_threads_delete(i);   6666     map_threads_delete(i);
6667     __Cont: /* CIL Label */   6667     __Cont: /* CIL Label */
6668     i ++;   6668     i ++;
6669   }   6669   }
6670   return;   6670   return;
6671 }   6671 }
6672 }   6672 }
6673 static void evh__HG_PTHREAD_JOIN_POST(ThreadId stay_tid , Thread *quit_thr )   6673 static void evh__HG_PTHREAD_JOIN_POST(ThreadId stay_tid , Thread *quit_thr )
6674 {   6674 {
6675   Thread *thr_s ;   6675   Thread *thr_s ;
6676   Thread *thr_q ;   6676   Thread *thr_q ;
6677   Thr *hbthr_s ;   6677   Thr *hbthr_s ;
6678   Thr *hbthr_q ;   6678   Thr *hbthr_q ;
6679   SO *so ;   6679   SO *so ;
6680   Bool tmp ;   6680   Bool tmp ;
6681   Thread *tmp___0 ;   6681   Thread *tmp___0 ;
6682   Thread *tmp___1 ;   6682   Thread *tmp___1 ;
6683   ThreadId tmp___2 ;   6683   ThreadId tmp___2 ;
6684     6684  
6685   {   6685   {
6686   tmp = vgHelgrind_is_sane_ThreadId(stay_tid);   6686   tmp = vgHelgrind_is_sane_ThreadId(stay_tid);
6687   if (tmp) {   6687   if (tmp) {
6688     6688  
6689   } else {   6689   } else {
6690     vgPlain_assert_fail((Bool )0,   6690     vgPlain_assert_fail((Bool )0,
6691                         (Char const   *)"HG_(is_sane_ThreadId)(stay_tid)",   6691                         (Char const   *)"HG_(is_sane_ThreadId)(stay_tid)",
6692                         (Char const   *)"hg_main.c", 1606,   6692                         (Char const   *)"hg_main.c", 1606,
6693                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");   6693                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");
6694   }   6694   }
6695   thr_s = map_threads_maybe_lookup(stay_tid);   6695   thr_s = map_threads_maybe_lookup(stay_tid);
6696   thr_q = quit_thr;   6696   thr_q = quit_thr;
6697   if ((unsigned int )thr_s != (unsigned int )((void *)0)) {   6697   if ((unsigned int )thr_s != (unsigned int )((void *)0)) {
6698     6698  
6699   } else {   6699   } else {
6700     vgPlain_assert_fail((Bool )0, (Char const   *)"thr_s != NULL",   6700     vgPlain_assert_fail((Bool )0, (Char const   *)"thr_s != NULL",
6701                         (Char const   *)"hg_main.c", 1610,   6701                         (Char const   *)"hg_main.c", 1610,
6702                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");   6702                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");
6703   }   6703   }
6704   if ((unsigned int )thr_q != (unsigned int )((void *)0)) {   6704   if ((unsigned int )thr_q != (unsigned int )((void *)0)) {
6705     6705  
6706   } else {   6706   } else {
6707     vgPlain_assert_fail((Bool )0, (Char const   *)"thr_q != NULL",   6707     vgPlain_assert_fail((Bool )0, (Char const   *)"thr_q != NULL",
6708                         (Char const   *)"hg_main.c", 1611,   6708                         (Char const   *)"hg_main.c", 1611,
6709                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");   6709                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");
6710   }   6710   }
6711   if ((unsigned int )thr_s != (unsigned int )thr_q) {   6711   if ((unsigned int )thr_s != (unsigned int )thr_q) {
6712     6712  
6713   } else {   6713   } else {
6714     vgPlain_assert_fail((Bool )0, (Char const   *)"thr_s != thr_q",   6714     vgPlain_assert_fail((Bool )0, (Char const   *)"thr_s != thr_q",
6715                         (Char const   *)"hg_main.c", 1612,   6715                         (Char const   *)"hg_main.c", 1612,
6716                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");   6716                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");
6717   }   6717   }
6718   hbthr_s = thr_s->hbthr;   6718   hbthr_s = thr_s->hbthr;
6719   hbthr_q = thr_q->hbthr;   6719   hbthr_q = thr_q->hbthr;
6720   if ((unsigned int )hbthr_s != (unsigned int )hbthr_q) {   6720   if ((unsigned int )hbthr_s != (unsigned int )hbthr_q) {
6721     6721  
6722   } else {   6722   } else {
6723     vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr_s != hbthr_q",   6723     vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr_s != hbthr_q",
6724                         (Char const   *)"hg_main.c", 1616,   6724                         (Char const   *)"hg_main.c", 1616,
6725                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");   6725                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");
6726   }   6726   }
6727   tmp___0 = libhb_get_Thr_hgthread(hbthr_s);   6727   tmp___0 = libhb_get_Thr_hgthread(hbthr_s);
6728   if ((unsigned int )tmp___0 == (unsigned int )thr_s) {   6728   if ((unsigned int )tmp___0 == (unsigned int )thr_s) {
6729     6729  
6730   } else {   6730   } else {
6731     vgPlain_assert_fail((Bool )0,   6731     vgPlain_assert_fail((Bool )0,
6732                         (Char const   *)"libhb_get_Thr_hgthread(hbthr_s) == thr_s",   6732                         (Char const   *)"libhb_get_Thr_hgthread(hbthr_s) == thr_s",
6733                         (Char const   *)"hg_main.c", 1617,   6733                         (Char const   *)"hg_main.c", 1617,
6734                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");   6734                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");
6735   }   6735   }
6736   tmp___1 = libhb_get_Thr_hgthread(hbthr_q);   6736   tmp___1 = libhb_get_Thr_hgthread(hbthr_q);
6737   if ((unsigned int )tmp___1 == (unsigned int )thr_q) {   6737   if ((unsigned int )tmp___1 == (unsigned int )thr_q) {
6738     6738  
6739   } else {   6739   } else {
6740     vgPlain_assert_fail((Bool )0,   6740     vgPlain_assert_fail((Bool )0,
6741                         (Char const   *)"libhb_get_Thr_hgthread(hbthr_q) == thr_q",   6741                         (Char const   *)"libhb_get_Thr_hgthread(hbthr_q) == thr_q",
6742                         (Char const   *)"hg_main.c", 1618,   6742                         (Char const   *)"hg_main.c", 1618,
6743                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");   6743                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");
6744   }   6744   }
6745   so = libhb_so_alloc();   6745   so = libhb_so_alloc();
6746   if (so) {   6746   if (so) {
6747     6747  
6748   } else {   6748   } else {
6749     vgPlain_assert_fail((Bool )0, (Char const   *)"so",   6749     vgPlain_assert_fail((Bool )0, (Char const   *)"so",
6750                         (Char const   *)"hg_main.c", 1625,   6750                         (Char const   *)"hg_main.c", 1625,
6751                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");   6751                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");
6752   }   6752   }
6753   libhb_so_send(hbthr_q, so, (Bool )1);   6753   libhb_so_send(hbthr_q, so, (Bool )1);
6754   libhb_so_recv(hbthr_s, so, (Bool )1);   6754   libhb_so_recv(hbthr_s, so, (Bool )1);
6755   libhb_so_dealloc(so);   6755   libhb_so_dealloc(so);
6756   tmp___2 = map_threads_maybe_reverse_lookup_SLOW(thr_q);   6756   tmp___2 = map_threads_maybe_reverse_lookup_SLOW(thr_q);
6757   if (tmp___2 == 0U) {   6757   if (tmp___2 == 0U) {
6758     6758  
6759   } else {   6759   } else {
6760     vgPlain_assert_fail((Bool )0,   6760     vgPlain_assert_fail((Bool )0,
6761                         (Char const   *)"map_threads_maybe_reverse_lookup_SLOW(thr_q) == VG_INVALID_THREADID",   6761                         (Char const   *)"map_threads_maybe_reverse_lookup_SLOW(thr_q) == VG_INVALID_THREADID",
6762                         (Char const   *)"hg_main.c", 1643,   6762                         (Char const   *)"hg_main.c", 1643,
6763                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");   6763                         (Char const   *)"evh__HG_PTHREAD_JOIN_POST", "");
6764   }   6764   }
6765   if (vgHelgrind_clo_sanity_flags & 1L) {   6765   if (vgHelgrind_clo_sanity_flags & 1L) {
6766     all__sanity_check((Char *)"evh__post_thread_join-post");   6766     all__sanity_check((Char *)"evh__post_thread_join-post");
6767   } else {   6767   } else {
6768     6768  
6769   }   6769   }
6770   return;   6770   return;
6771 }   6771 }
6772 }   6772 }
6773 static void evh__pre_mem_read(CorePart part , ThreadId tid , Char *s , Addr a ,   6773 static void evh__pre_mem_read(CorePart part , ThreadId tid , Char *s , Addr a ,
6774                               SizeT size )   6774                               SizeT size )
6775 {   6775 {
6776   Thread *tmp ;   6776   Thread *tmp ;
6777     6777  
6778   {   6778   {
6779   tmp = map_threads_lookup(tid);   6779   tmp = map_threads_lookup(tid);
6780   shadow_mem_cread_range(tmp, a, size);   6780   shadow_mem_cread_range(tmp, a, size);
6781   if (size >= 256UL) {   6781   if (size >= 256UL) {
6782     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6782     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6783       all__sanity_check((Char *)"evh__pre_mem_read-post");   6783       all__sanity_check((Char *)"evh__pre_mem_read-post");
6784     } else {   6784     } else {
6785     6785  
6786     }   6786     }
6787   } else {   6787   } else {
6788     6788  
6789   }   6789   }
6790   return;   6790   return;
6791 }   6791 }
6792 }   6792 }
6793 static void evh__pre_mem_read_asciiz(CorePart part , ThreadId tid , Char *s ,   6793 static void evh__pre_mem_read_asciiz(CorePart part , ThreadId tid , Char *s ,
6794                                      Addr a )   6794                                      Addr a )
6795 {   6795 {
6796   Int len ;   6796   Int len ;
6797   Bool tmp ;   6797   Bool tmp ;
6798   SizeT tmp___0 ;   6798   SizeT tmp___0 ;
6799   Thread *tmp___1 ;   6799   Thread *tmp___1 ;
6800     6800  
6801   {   6801   {
6802   tmp = vgPlain_am_is_valid_for_client(a, (SizeT )1, (UInt )1);   6802   tmp = vgPlain_am_is_valid_for_client(a, (SizeT )1, (UInt )1);
6803   if (tmp) {   6803   if (tmp) {
6804     6804  
6805   } else {   6805   } else {
6806     return;   6806     return;
6807   }   6807   }
6808   tmp___0 = vgPlain_strlen((Char const   *)((Char *)a));   6808   tmp___0 = vgPlain_strlen((Char const   *)((Char *)a));
6809   len = (Int )tmp___0;   6809   len = (Int )tmp___0;
6810   tmp___1 = map_threads_lookup(tid);   6810   tmp___1 = map_threads_lookup(tid);
6811   shadow_mem_cread_range(tmp___1, a, (SizeT )(len + 1));   6811   shadow_mem_cread_range(tmp___1, a, (SizeT )(len + 1));
6812   if (len >= 256) {   6812   if (len >= 256) {
6813     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6813     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6814       all__sanity_check((Char *)"evh__pre_mem_read_asciiz-post");   6814       all__sanity_check((Char *)"evh__pre_mem_read_asciiz-post");
6815     } else {   6815     } else {
6816     6816  
6817     }   6817     }
6818   } else {   6818   } else {
6819     6819  
6820   }   6820   }
6821   return;   6821   return;
6822 }   6822 }
6823 }   6823 }
6824 static void evh__pre_mem_write(CorePart part , ThreadId tid , Char *s , Addr a ,   6824 static void evh__pre_mem_write(CorePart part , ThreadId tid , Char *s , Addr a ,
6825                                SizeT size )   6825                                SizeT size )
6826 {   6826 {
6827   Thread *tmp ;   6827   Thread *tmp ;
6828     6828  
6829   {   6829   {
6830   tmp = map_threads_lookup(tid);   6830   tmp = map_threads_lookup(tid);
6831   shadow_mem_cwrite_range(tmp, a, size);   6831   shadow_mem_cwrite_range(tmp, a, size);
6832   if (size >= 256UL) {   6832   if (size >= 256UL) {
6833     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6833     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6834       all__sanity_check((Char *)"evh__pre_mem_write-post");   6834       all__sanity_check((Char *)"evh__pre_mem_write-post");
6835     } else {   6835     } else {
6836     6836  
6837     }   6837     }
6838   } else {   6838   } else {
6839     6839  
6840   }   6840   }
6841   return;   6841   return;
6842 }   6842 }
6843 }   6843 }
6844 static void evh__new_mem_heap(Addr a , SizeT len , Bool is_inited )   6844 static void evh__new_mem_heap(Addr a , SizeT len , Bool is_inited )
6845 {   6845 {
6846   Thread *tmp ;   6846   Thread *tmp ;
6847   Thread *tmp___0 ;   6847   Thread *tmp___0 ;
6848     6848  
6849   {   6849   {
6850   if (is_inited) {   6850   if (is_inited) {
6851     tmp = get_current_Thread();   6851     tmp = get_current_Thread();
6852     shadow_mem_make_New(tmp, a, len);   6852     shadow_mem_make_New(tmp, a, len);
6853   } else {   6853   } else {
6854     tmp___0 = get_current_Thread();   6854     tmp___0 = get_current_Thread();
6855     shadow_mem_make_New(tmp___0, a, len);   6855     shadow_mem_make_New(tmp___0, a, len);
6856   }   6856   }
6857   if (len >= 256UL) {   6857   if (len >= 256UL) {
6858     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6858     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6859       all__sanity_check((Char *)"evh__pre_mem_read-post");   6859       all__sanity_check((Char *)"evh__pre_mem_read-post");
6860     } else {   6860     } else {
6861     6861  
6862     }   6862     }
6863   } else {   6863   } else {
6864     6864  
6865   }   6865   }
6866   return;   6866   return;
6867 }   6867 }
6868 }   6868 }
6869 static void evh__die_mem_heap(Addr a , SizeT len )   6869 static void evh__die_mem_heap(Addr a , SizeT len )
6870 {   6870 {
6871   Thread *tmp ;   6871   Thread *tmp ;
6872     6872  
6873   {   6873   {
6874   tmp = get_current_Thread();   6874   tmp = get_current_Thread();
6875   shadow_mem_make_NoAccess(tmp, a, len);   6875   shadow_mem_make_NoAccess(tmp, a, len);
6876   if (len >= 256UL) {   6876   if (len >= 256UL) {
6877     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {   6877     if (vgHelgrind_clo_sanity_flags & (long )(1 << 2)) {
6878       all__sanity_check((Char *)"evh__pre_mem_read-post");   6878       all__sanity_check((Char *)"evh__pre_mem_read-post");
6879     } else {   6879     } else {
6880     6880  
6881     }   6881     }
6882   } else {   6882   } else {
6883     6883  
6884   }   6884   }
6885   return;   6885   return;
6886 }   6886 }
6887 }   6887 }
6888 static void ( __attribute__((__regparm__(1))) evh__mem_help_cread_1)(Addr a )   6888 static void ( __attribute__((__regparm__(1))) evh__mem_help_cread_1)(Addr a )
6889 {   6889 {
6890   Thread *thr ;   6890   Thread *thr ;
6891   Thread *tmp ;   6891   Thread *tmp ;
6892   Thr *hbthr ;   6892   Thr *hbthr ;
6893     6893  
6894   {   6894   {
6895   tmp = get_current_Thread_in_C_C();   6895   tmp = get_current_Thread_in_C_C();
6896   thr = tmp;   6896   thr = tmp;
6897   hbthr = thr->hbthr;   6897   hbthr = thr->hbthr;
6898   zsm_sapply08_f__msmcread(hbthr, a);   6898   zsm_sapply08_f__msmcread(hbthr, a);
6899   return;   6899   return;
6900 }   6900 }
6901 }   6901 }
6902 static void ( __attribute__((__regparm__(1))) evh__mem_help_cread_2)(Addr a )   6902 static void ( __attribute__((__regparm__(1))) evh__mem_help_cread_2)(Addr a )
6903 {   6903 {
6904   Thread *thr ;   6904   Thread *thr ;
6905   Thread *tmp ;   6905   Thread *tmp ;
6906   Thr *hbthr ;   6906   Thr *hbthr ;
6907     6907  
6908   {   6908   {
6909   tmp = get_current_Thread_in_C_C();   6909   tmp = get_current_Thread_in_C_C();
6910   thr = tmp;   6910   thr = tmp;
6911   hbthr = thr->hbthr;   6911   hbthr = thr->hbthr;
6912   zsm_sapply16_f__msmcread(hbthr, a);   6912   zsm_sapply16_f__msmcread(hbthr, a);
6913   return;   6913   return;
6914 }   6914 }
6915 }   6915 }
6916 static void ( __attribute__((__regparm__(1))) evh__mem_help_cread_4)(Addr a )   6916 static void ( __attribute__((__regparm__(1))) evh__mem_help_cread_4)(Addr a )
6917 {   6917 {
6918   Thread *thr ;   6918   Thread *thr ;
6919   Thread *tmp ;   6919   Thread *tmp ;
6920   Thr *hbthr ;   6920   Thr *hbthr ;
6921     6921  
6922   {   6922   {
6923   tmp = get_current_Thread_in_C_C();   6923   tmp = get_current_Thread_in_C_C();
6924   thr = tmp;   6924   thr = tmp;
6925   hbthr = thr->hbthr;   6925   hbthr = thr->hbthr;
6926   zsm_sapply32_f__msmcread(hbthr, a);   6926   zsm_sapply32_f__msmcread(hbthr, a);
6927   return;   6927   return;
6928 }   6928 }
6929 }   6929 }
6930 static void ( __attribute__((__regparm__(1))) evh__mem_help_cread_8)(Addr a )   6930 static void ( __attribute__((__regparm__(1))) evh__mem_help_cread_8)(Addr a )
6931 {   6931 {
6932   Thread *thr ;   6932   Thread *thr ;
6933   Thread *tmp ;   6933   Thread *tmp ;
6934   Thr *hbthr ;   6934   Thr *hbthr ;
6935     6935  
6936   {   6936   {
6937   tmp = get_current_Thread_in_C_C();   6937   tmp = get_current_Thread_in_C_C();
6938   thr = tmp;   6938   thr = tmp;
6939   hbthr = thr->hbthr;   6939   hbthr = thr->hbthr;
6940   zsm_sapply64_f__msmcread(hbthr, a);   6940   zsm_sapply64_f__msmcread(hbthr, a);
6941   return;   6941   return;
6942 }   6942 }
6943 }   6943 }
6944 static void ( __attribute__((__regparm__(2))) evh__mem_help_cread_N)(Addr a ,   6944 static void ( __attribute__((__regparm__(2))) evh__mem_help_cread_N)(Addr a ,
6945                                                                      SizeT size )   6945                                                                      SizeT size )
6946 {   6946 {
6947   Thread *thr ;   6947   Thread *thr ;
6948   Thread *tmp ;   6948   Thread *tmp ;
6949   Thr *hbthr ;   6949   Thr *hbthr ;
6950     6950  
6951   {   6951   {
6952   tmp = get_current_Thread_in_C_C();   6952   tmp = get_current_Thread_in_C_C();
6953   thr = tmp;   6953   thr = tmp;
6954   hbthr = thr->hbthr;   6954   hbthr = thr->hbthr;
6955   zsm_sapplyNN_f__msmcread(hbthr, a, size);   6955   zsm_sapplyNN_f__msmcread(hbthr, a, size);
6956   return;   6956   return;
6957 }   6957 }
6958 }   6958 }
6959 static void ( __attribute__((__regparm__(1))) evh__mem_help_cwrite_1)(Addr a )   6959 static void ( __attribute__((__regparm__(1))) evh__mem_help_cwrite_1)(Addr a )
6960 {   6960 {
6961   Thread *thr ;   6961   Thread *thr ;
6962   Thread *tmp ;   6962   Thread *tmp ;
6963   Thr *hbthr ;   6963   Thr *hbthr ;
6964     6964  
6965   {   6965   {
6966   tmp = get_current_Thread_in_C_C();   6966   tmp = get_current_Thread_in_C_C();
6967   thr = tmp;   6967   thr = tmp;
6968   hbthr = thr->hbthr;   6968   hbthr = thr->hbthr;
6969   zsm_sapply08_f__msmcwrite(hbthr, a);   6969   zsm_sapply08_f__msmcwrite(hbthr, a);
6970   return;   6970   return;
6971 }   6971 }
6972 }   6972 }
6973 static void ( __attribute__((__regparm__(1))) evh__mem_help_cwrite_2)(Addr a )   6973 static void ( __attribute__((__regparm__(1))) evh__mem_help_cwrite_2)(Addr a )
6974 {   6974 {
6975   Thread *thr ;   6975   Thread *thr ;
6976   Thread *tmp ;   6976   Thread *tmp ;
6977   Thr *hbthr ;   6977   Thr *hbthr ;
6978     6978  
6979   {   6979   {
6980   tmp = get_current_Thread_in_C_C();   6980   tmp = get_current_Thread_in_C_C();
6981   thr = tmp;   6981   thr = tmp;
6982   hbthr = thr->hbthr;   6982   hbthr = thr->hbthr;
6983   zsm_sapply16_f__msmcwrite(hbthr, a);   6983   zsm_sapply16_f__msmcwrite(hbthr, a);
6984   return;   6984   return;
6985 }   6985 }
6986 }   6986 }
6987 static void ( __attribute__((__regparm__(1))) evh__mem_help_cwrite_4)(Addr a )   6987 static void ( __attribute__((__regparm__(1))) evh__mem_help_cwrite_4)(Addr a )
6988 {   6988 {
6989   Thread *thr ;   6989   Thread *thr ;
6990   Thread *tmp ;   6990   Thread *tmp ;
6991   Thr *hbthr ;   6991   Thr *hbthr ;
6992     6992  
6993   {   6993   {
6994   tmp = get_current_Thread_in_C_C();   6994   tmp = get_current_Thread_in_C_C();
6995   thr = tmp;   6995   thr = tmp;
6996   hbthr = thr->hbthr;   6996   hbthr = thr->hbthr;
6997   zsm_sapply32_f__msmcwrite(hbthr, a);   6997   zsm_sapply32_f__msmcwrite(hbthr, a);
6998   return;   6998   return;
6999 }   6999 }
7000 }   7000 }
7001 static void ( __attribute__((__regparm__(1))) evh__mem_help_cwrite_8)(Addr a )   7001 static void ( __attribute__((__regparm__(1))) evh__mem_help_cwrite_8)(Addr a )
7002 {   7002 {
7003   Thread *thr ;   7003   Thread *thr ;
7004   Thread *tmp ;   7004   Thread *tmp ;
7005   Thr *hbthr ;   7005   Thr *hbthr ;
7006     7006  
7007   {   7007   {
7008   tmp = get_current_Thread_in_C_C();   7008   tmp = get_current_Thread_in_C_C();
7009   thr = tmp;   7009   thr = tmp;
7010   hbthr = thr->hbthr;   7010   hbthr = thr->hbthr;
7011   zsm_sapply64_f__msmcwrite(hbthr, a);   7011   zsm_sapply64_f__msmcwrite(hbthr, a);
7012   return;   7012   return;
7013 }   7013 }
7014 }   7014 }
7015 static void ( __attribute__((__regparm__(2))) evh__mem_help_cwrite_N)(Addr a ,   7015 static void ( __attribute__((__regparm__(2))) evh__mem_help_cwrite_N)(Addr a ,
7016                                                                       SizeT size )   7016                                                                       SizeT size )
7017 {   7017 {
7018   Thread *thr ;   7018   Thread *thr ;
7019   Thread *tmp ;   7019   Thread *tmp ;
7020   Thr *hbthr ;   7020   Thr *hbthr ;
7021     7021  
7022   {   7022   {
7023   tmp = get_current_Thread_in_C_C();   7023   tmp = get_current_Thread_in_C_C();
7024   thr = tmp;   7024   thr = tmp;
7025   hbthr = thr->hbthr;   7025   hbthr = thr->hbthr;
7026   zsm_sapplyNN_f__msmcwrite(hbthr, a, size);   7026   zsm_sapplyNN_f__msmcwrite(hbthr, a, size);
7027   return;   7027   return;
7028 }   7028 }
7029 }   7029 }
7030 static void evh__HG_PTHREAD_MUTEX_INIT_POST(ThreadId tid , void *mutex ,   7030 static void evh__HG_PTHREAD_MUTEX_INIT_POST(ThreadId tid , void *mutex ,
7031                                             Word mbRec )   7031                                             Word mbRec )
7032 {   7032 {
7033   int tmp ;   7033   int tmp ;
7034     7034  
7035   {   7035   {
7036   if (mbRec == 0L) {   7036   if (mbRec == 0L) {
7037     7037  
7038   } else   7038   } else
7039   if (mbRec == 1L) {   7039   if (mbRec == 1L) {
7040     7040  
7041   } else {   7041   } else {
7042     vgPlain_assert_fail((Bool )0, (Char const   *)"mbRec == 0 || mbRec == 1",   7042     vgPlain_assert_fail((Bool )0, (Char const   *)"mbRec == 0 || mbRec == 1",
7043                         (Char const   *)"hg_main.c", 1803,   7043                         (Char const   *)"hg_main.c", 1803,
7044                         (Char const   *)"evh__HG_PTHREAD_MUTEX_INIT_POST", "");   7044                         (Char const   *)"evh__HG_PTHREAD_MUTEX_INIT_POST", "");
7045   }   7045   }
7046   if (mbRec) {   7046   if (mbRec) {
7047     tmp = 1001;   7047     tmp = 1001;
7048   } else {   7048   } else {
7049     tmp = 1002;   7049     tmp = 1002;
7050   }   7050   }
7051   map_locks_lookup_or_create((LockKind )tmp, (Addr )mutex, tid);   7051   map_locks_lookup_or_create((LockKind )tmp, (Addr )mutex, tid);
7052   if (vgHelgrind_clo_sanity_flags & (long )(1 << 1)) {   7052   if (vgHelgrind_clo_sanity_flags & (long )(1 << 1)) {
7053     all__sanity_check((Char *)"evh__hg_PTHREAD_MUTEX_INIT_POST");   7053     all__sanity_check((Char *)"evh__hg_PTHREAD_MUTEX_INIT_POST");
7054   } else {   7054   } else {
7055     7055  
7056   }   7056   }
7057   return;   7057   return;
7058 }   7058 }
7059 }   7059 }
7060 static void evh__HG_PTHREAD_MUTEX_DESTROY_PRE(ThreadId tid , void *mutex )   7060 static void evh__HG_PTHREAD_MUTEX_DESTROY_PRE(ThreadId tid , void *mutex )
7061 {   7061 {
7062   Thread *thr ;   7062   Thread *thr ;
7063   Lock *lk ;   7063   Lock *lk ;
7064   Bool tmp ;   7064   Bool tmp ;
7065   Bool tmp___0 ;   7065   Bool tmp___0 ;
7066   Bool tmp___1 ;   7066   Bool tmp___1 ;
7067     7067  
7068   {   7068   {
7069   thr = map_threads_maybe_lookup(tid);   7069   thr = map_threads_maybe_lookup(tid);
7070   tmp = vgHelgrind_is_sane_Thread(thr);   7070   tmp = vgHelgrind_is_sane_Thread(thr);
7071   if (tmp) {   7071   if (tmp) {
7072     7072  
7073   } else {   7073   } else {
7074     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",   7074     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",
7075                         (Char const   *)"hg_main.c", 1821,   7075                         (Char const   *)"hg_main.c", 1821,
7076                         (Char const   *)"evh__HG_PTHREAD_MUTEX_DESTROY_PRE", "");   7076                         (Char const   *)"evh__HG_PTHREAD_MUTEX_DESTROY_PRE", "");
7077   }   7077   }
7078   lk = map_locks_maybe_lookup((Addr )mutex);   7078   lk = map_locks_maybe_lookup((Addr )mutex);
7079   if ((unsigned int )lk == (unsigned int )((void *)0)) {   7079   if ((unsigned int )lk == (unsigned int )((void *)0)) {
7080     vgHelgrind_record_error_Misc(thr,   7080     vgHelgrind_record_error_Misc(thr,
7081                                  (HChar *)"pthread_mutex_destroy with invalid argument");   7081                                  (HChar *)"pthread_mutex_destroy with invalid argument");
7082   } else   7082   } else
7083   if ((unsigned int )lk->kind != 1002U) {   7083   if ((unsigned int )lk->kind != 1002U) {
7084     if ((unsigned int )lk->kind != 1001U) {   7084     if ((unsigned int )lk->kind != 1001U) {
7085       vgHelgrind_record_error_Misc(thr,   7085       vgHelgrind_record_error_Misc(thr,
7086                                    (HChar *)"pthread_mutex_destroy with invalid argument");   7086                                    (HChar *)"pthread_mutex_destroy with invalid argument");
7087     } else {   7087     } else {
7088     7088  
7089     }   7089     }
7090   } else {   7090   } else {
7091     7091  
7092   }   7092   }
7093   if (lk) {   7093   if (lk) {
7094     tmp___0 = vgHelgrind_is_sane_LockN(lk);   7094     tmp___0 = vgHelgrind_is_sane_LockN(lk);
7095     if (tmp___0) {   7095     if (tmp___0) {
7096     7096  
7097     } else {   7097     } else {
7098       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   7098       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
7099                           (Char const   *)"hg_main.c", 1831,   7099                           (Char const   *)"hg_main.c", 1831,
7100                           (Char const   *)"evh__HG_PTHREAD_MUTEX_DESTROY_PRE",   7100                           (Char const   *)"evh__HG_PTHREAD_MUTEX_DESTROY_PRE",
7101                           "");   7101                           "");
7102     }   7102     }
7103     if (lk->guestaddr == (Addr )mutex) {   7103     if (lk->guestaddr == (Addr )mutex) {
7104     7104  
7105     } else {   7105     } else {
7106       vgPlain_assert_fail((Bool )0,   7106       vgPlain_assert_fail((Bool )0,
7107                           (Char const   *)"lk->guestaddr == (Addr)mutex",   7107                           (Char const   *)"lk->guestaddr == (Addr)mutex",
7108                           (Char const   *)"hg_main.c", 1832,   7108                           (Char const   *)"hg_main.c", 1832,
7109                           (Char const   *)"evh__HG_PTHREAD_MUTEX_DESTROY_PRE",   7109                           (Char const   *)"evh__HG_PTHREAD_MUTEX_DESTROY_PRE",
7110                           "");   7110                           "");
7111     }   7111     }
7112     if (lk->heldBy) {   7112     if (lk->heldBy) {
7113       vgHelgrind_record_error_Misc(thr,   7113       vgHelgrind_record_error_Misc(thr,
7114                                    (HChar *)"pthread_mutex_destroy of a locked mutex");   7114                                    (HChar *)"pthread_mutex_destroy of a locked mutex");
7115       remove_Lock_from_locksets_of_all_owning_Threads(lk);   7115       remove_Lock_from_locksets_of_all_owning_Threads(lk);
7116       vgPlain_deleteBag(lk->heldBy);   7116       vgPlain_deleteBag(lk->heldBy);
7117       lk->heldBy = (WordBag *)((void *)0);   7117       lk->heldBy = (WordBag *)((void *)0);
7118       lk->heldW = (Bool )0;   7118       lk->heldW = (Bool )0;
7119       lk->acquired_at = (ExeContext *)((void *)0);   7119       lk->acquired_at = (ExeContext *)((void *)0);
7120     } else {   7120     } else {
7121     7121  
7122     }   7122     }
7123     if (! lk->heldBy) {   7123     if (! lk->heldBy) {
7124     7124  
7125     } else {   7125     } else {
7126       vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldBy",   7126       vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldBy",
7127                           (Char const   *)"hg_main.c", 1844,   7127                           (Char const   *)"hg_main.c", 1844,
7128                           (Char const   *)"evh__HG_PTHREAD_MUTEX_DESTROY_PRE",   7128                           (Char const   *)"evh__HG_PTHREAD_MUTEX_DESTROY_PRE",
7129                           "");   7129                           "");
7130     }   7130     }
7131     tmp___1 = vgHelgrind_is_sane_LockN(lk);   7131     tmp___1 = vgHelgrind_is_sane_LockN(lk);
7132     if (tmp___1) {   7132     if (tmp___1) {
7133     7133  
7134     } else {   7134     } else {
7135       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   7135       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
7136                           (Char const   *)"hg_main.c", 1845,   7136                           (Char const   *)"hg_main.c", 1845,
7137                           (Char const   *)"evh__HG_PTHREAD_MUTEX_DESTROY_PRE",   7137                           (Char const   *)"evh__HG_PTHREAD_MUTEX_DESTROY_PRE",
7138                           "");   7138                           "");
7139     }   7139     }
7140     if (vgHelgrind_clo_track_lockorders) {   7140     if (vgHelgrind_clo_track_lockorders) {
7141       laog__handle_one_lock_deletion(lk);   7141       laog__handle_one_lock_deletion(lk);
7142     } else {   7142     } else {
7143     7143  
7144     }   7144     }
7145     map_locks_delete(lk->guestaddr);   7145     map_locks_delete(lk->guestaddr);
7146     del_LockN(lk);   7146     del_LockN(lk);
7147   } else {   7147   } else {
7148     7148  
7149   }   7149   }
7150   if (vgHelgrind_clo_sanity_flags & (long )(1 << 1)) {   7150   if (vgHelgrind_clo_sanity_flags & (long )(1 << 1)) {
7151     all__sanity_check((Char *)"evh__hg_PTHREAD_MUTEX_DESTROY_PRE");   7151     all__sanity_check((Char *)"evh__hg_PTHREAD_MUTEX_DESTROY_PRE");
7152   } else {   7152   } else {
7153     7153  
7154   }   7154   }
7155   return;   7155   return;
7156 }   7156 }
7157 }   7157 }
7158 static void evh__HG_PTHREAD_MUTEX_LOCK_PRE(ThreadId tid , void *mutex ,   7158 static void evh__HG_PTHREAD_MUTEX_LOCK_PRE(ThreadId tid , void *mutex ,
7159                                            Word isTryLock )   7159                                            Word isTryLock )
7160 {   7160 {
7161   Thread *thr ;   7161   Thread *thr ;
7162   Lock *lk ;   7162   Lock *lk ;
7163   HChar *errstr ;   7163   HChar *errstr ;
7164   HChar *auxstr ;   7164   HChar *auxstr ;
7165   UWord tmp ;   7165   UWord tmp ;
7166     7166  
7167   {   7167   {
7168   if (isTryLock == 0L) {   7168   if (isTryLock == 0L) {
7169     7169  
7170   } else   7170   } else
7171   if (isTryLock == 1L) {   7171   if (isTryLock == 1L) {
7172     7172  
7173   } else {   7173   } else {
7174     vgPlain_assert_fail((Bool )0,   7174     vgPlain_assert_fail((Bool )0,
7175                         (Char const   *)"isTryLock == 0 || isTryLock == 1",   7175                         (Char const   *)"isTryLock == 0 || isTryLock == 1",
7176                         (Char const   *)"hg_main.c", 1868,   7176                         (Char const   *)"hg_main.c", 1868,
7177                         (Char const   *)"evh__HG_PTHREAD_MUTEX_LOCK_PRE", "");   7177                         (Char const   *)"evh__HG_PTHREAD_MUTEX_LOCK_PRE", "");
7178   }   7178   }
7179   thr = map_threads_maybe_lookup(tid);   7179   thr = map_threads_maybe_lookup(tid);
7180   if (thr) {   7180   if (thr) {
7181     7181  
7182   } else {   7182   } else {
7183     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   7183     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
7184                         (Char const   *)"hg_main.c", 1870,   7184                         (Char const   *)"hg_main.c", 1870,
7185                         (Char const   *)"evh__HG_PTHREAD_MUTEX_LOCK_PRE", "");   7185                         (Char const   *)"evh__HG_PTHREAD_MUTEX_LOCK_PRE", "");
7186   }   7186   }
7187   lk = map_locks_maybe_lookup((Addr )mutex);   7187   lk = map_locks_maybe_lookup((Addr )mutex);
7188   if (lk) {   7188   if (lk) {
7189     if ((unsigned int )lk->kind == 1003U) {   7189     if ((unsigned int )lk->kind == 1003U) {
7190       vgHelgrind_record_error_Misc(thr,   7190       vgHelgrind_record_error_Misc(thr,
7191                                    (HChar *)"pthread_mutex_lock with a pthread_rwlock_t* argument ");   7191                                    (HChar *)"pthread_mutex_lock with a pthread_rwlock_t* argument ");
7192     } else {   7192     } else {
7193     7193  
7194     }   7194     }
7195   } else {   7195   } else {
7196     7196  
7197   }   7197   }
7198   if (lk) {   7198   if (lk) {
7199     if (isTryLock == 0L) {   7199     if (isTryLock == 0L) {
7200       if ((unsigned int )lk->kind == 1002U) {   7200       if ((unsigned int )lk->kind == 1002U) {
7201         goto _L;   7201         goto _L;
7202       } else   7202       } else
7203       if ((unsigned int )lk->kind == 1003U) {   7203       if ((unsigned int )lk->kind == 1003U) {
7204         _L: /* CIL Label */   7204         _L: /* CIL Label */
7205         if (lk->heldBy) {   7205         if (lk->heldBy) {
7206           if (lk->heldW) {   7206           if (lk->heldW) {
7207             tmp = vgPlain_elemBag(lk->heldBy, (UWord )((Word )thr));   7207             tmp = vgPlain_elemBag(lk->heldBy, (UWord )((Word )thr));
7208             if (tmp > 0UL) {   7208             if (tmp > 0UL) {
7209               errstr = (HChar *)"Attempt to re-lock a non-recursive lock I already hold";   7209               errstr = (HChar *)"Attempt to re-lock a non-recursive lock I already hold";
7210               auxstr = (HChar *)"Lock was previously acquired";   7210               auxstr = (HChar *)"Lock was previously acquired";
7211               if (lk->acquired_at) {   7211               if (lk->acquired_at) {
7212                 vgHelgrind_record_error_Misc_w_aux(thr, errstr, auxstr,   7212                 vgHelgrind_record_error_Misc_w_aux(thr, errstr, auxstr,
7213                                                    lk->acquired_at);   7213                                                    lk->acquired_at);
7214               } else {   7214               } else {
7215                 vgHelgrind_record_error_Misc(thr, errstr);   7215                 vgHelgrind_record_error_Misc(thr, errstr);
7216               }   7216               }
7217             } else {   7217             } else {
7218     7218  
7219             }   7219             }
7220           } else {   7220           } else {
7221     7221  
7222           }   7222           }
7223         } else {   7223         } else {
7224     7224  
7225         }   7225         }
7226       } else {   7226       } else {
7227     7227  
7228       }   7228       }
7229     } else {   7229     } else {
7230     7230  
7231     }   7231     }
7232   } else {   7232   } else {
7233     7233  
7234   }   7234   }
7235   return;   7235   return;
7236 }   7236 }
7237 }   7237 }
7238 static void evh__HG_PTHREAD_MUTEX_LOCK_POST(ThreadId tid , void *mutex )   7238 static void evh__HG_PTHREAD_MUTEX_LOCK_POST(ThreadId tid , void *mutex )
7239 {   7239 {
7240   Thread *thr ;   7240   Thread *thr ;
7241     7241  
7242   {   7242   {
7243   thr = map_threads_maybe_lookup(tid);   7243   thr = map_threads_maybe_lookup(tid);
7244   if (thr) {   7244   if (thr) {
7245     7245  
7246   } else {   7246   } else {
7247     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   7247     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
7248                         (Char const   *)"hg_main.c", 1909,   7248                         (Char const   *)"hg_main.c", 1909,
7249                         (Char const   *)"evh__HG_PTHREAD_MUTEX_LOCK_POST", "");   7249                         (Char const   *)"evh__HG_PTHREAD_MUTEX_LOCK_POST", "");
7250   }   7250   }
7251   evhH__post_thread_w_acquires_lock(thr, (LockKind )1001, (Addr )mutex);   7251   evhH__post_thread_w_acquires_lock(thr, (LockKind )1001, (Addr )mutex);
7252   return;   7252   return;
7253 }   7253 }
7254 }   7254 }
7255 static void evh__HG_PTHREAD_MUTEX_UNLOCK_PRE(ThreadId tid , void *mutex )   7255 static void evh__HG_PTHREAD_MUTEX_UNLOCK_PRE(ThreadId tid , void *mutex )
7256 {   7256 {
7257   Thread *thr ;   7257   Thread *thr ;
7258     7258  
7259   {   7259   {
7260   thr = map_threads_maybe_lookup(tid);   7260   thr = map_threads_maybe_lookup(tid);
7261   if (thr) {   7261   if (thr) {
7262     7262  
7263   } else {   7263   } else {
7264     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   7264     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
7265                         (Char const   *)"hg_main.c", 1927,   7265                         (Char const   *)"hg_main.c", 1927,
7266                         (Char const   *)"evh__HG_PTHREAD_MUTEX_UNLOCK_PRE", "");   7266                         (Char const   *)"evh__HG_PTHREAD_MUTEX_UNLOCK_PRE", "");
7267   }   7267   }
7268   evhH__pre_thread_releases_lock(thr, (Addr )mutex, (Bool )0);   7268   evhH__pre_thread_releases_lock(thr, (Addr )mutex, (Bool )0);
7269   return;   7269   return;
7270 }   7270 }
7271 }   7271 }
7272 static void evh__HG_PTHREAD_MUTEX_UNLOCK_POST(ThreadId tid , void *mutex )   7272 static void evh__HG_PTHREAD_MUTEX_UNLOCK_POST(ThreadId tid , void *mutex )
7273 {   7273 {
7274   Thread *thr ;   7274   Thread *thr ;
7275     7275  
7276   {   7276   {
7277   thr = map_threads_maybe_lookup(tid);   7277   thr = map_threads_maybe_lookup(tid);
7278   if (thr) {   7278   if (thr) {
7279     7279  
7280   } else {   7280   } else {
7281     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   7281     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
7282                         (Char const   *)"hg_main.c", 1940,   7282                         (Char const   *)"hg_main.c", 1940,
7283                         (Char const   *)"evh__HG_PTHREAD_MUTEX_UNLOCK_POST", "");   7283                         (Char const   *)"evh__HG_PTHREAD_MUTEX_UNLOCK_POST", "");
7284   }   7284   }
7285   return;   7285   return;
7286 }   7286 }
7287 }   7287 }
7288 static void evh__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_PRE(ThreadId tid , void *slock )   7288 static void evh__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_PRE(ThreadId tid , void *slock )
7289 {   7289 {
7290   Thread *thr ;   7290   Thread *thr ;
7291   Lock *lk ;   7291   Lock *lk ;
7292   Bool tmp ;   7292   Bool tmp ;
7293     7293  
7294   {   7294   {
7295   thr = map_threads_maybe_lookup(tid);   7295   thr = map_threads_maybe_lookup(tid);
7296   tmp = vgHelgrind_is_sane_Thread(thr);   7296   tmp = vgHelgrind_is_sane_Thread(thr);
7297   if (tmp) {   7297   if (tmp) {
7298     7298  
7299   } else {   7299   } else {
7300     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",   7300     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",
7301                         (Char const   *)"hg_main.c", 1969,   7301                         (Char const   *)"hg_main.c", 1969,
7302                         (Char const   *)"evh__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_PRE",   7302                         (Char const   *)"evh__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_PRE",
7303                         "");   7303                         "");
7304   }   7304   }
7305   lk = map_locks_maybe_lookup((Addr )slock);   7305   lk = map_locks_maybe_lookup((Addr )slock);
7306   if (lk) {   7306   if (lk) {
7307     if (lk->heldBy) {   7307     if (lk->heldBy) {
7308       evhH__pre_thread_releases_lock(thr, (Addr )slock, (Bool )0);   7308       evhH__pre_thread_releases_lock(thr, (Addr )slock, (Bool )0);
7309     } else {   7309     } else {
7310     7310  
7311     }   7311     }
7312   } else {   7312   } else {
7313     7313  
7314   }   7314   }
7315   return;   7315   return;
7316 }   7316 }
7317 }   7317 }
7318 static void evh__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_POST(ThreadId tid , void *slock )   7318 static void evh__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_POST(ThreadId tid , void *slock )
7319 {   7319 {
7320   Lock *lk ;   7320   Lock *lk ;
7321     7321  
7322   {   7322   {
7323   lk = map_locks_maybe_lookup((Addr )slock);   7323   lk = map_locks_maybe_lookup((Addr )slock);
7324   if (! lk) {   7324   if (! lk) {
7325     map_locks_lookup_or_create((LockKind )1002, (Addr )slock, tid);   7325     map_locks_lookup_or_create((LockKind )1002, (Addr )slock, tid);
7326   } else {   7326   } else {
7327     7327  
7328   }   7328   }
7329   return;   7329   return;
7330 }   7330 }
7331 }   7331 }
7332 static void evh__HG_PTHREAD_SPIN_LOCK_PRE(ThreadId tid , void *slock ,   7332 static void evh__HG_PTHREAD_SPIN_LOCK_PRE(ThreadId tid , void *slock ,
7333                                           Word isTryLock )   7333                                           Word isTryLock )
7334 {   7334 {
7335     7335  
7336     7336  
7337   {   7337   {
7338   evh__HG_PTHREAD_MUTEX_LOCK_PRE(tid, slock, isTryLock);   7338   evh__HG_PTHREAD_MUTEX_LOCK_PRE(tid, slock, isTryLock);
7339   return;   7339   return;
7340 }   7340 }
7341 }   7341 }
7342 static void evh__HG_PTHREAD_SPIN_LOCK_POST(ThreadId tid , void *slock )   7342 static void evh__HG_PTHREAD_SPIN_LOCK_POST(ThreadId tid , void *slock )
7343 {   7343 {
7344     7344  
7345     7345  
7346   {   7346   {
7347   evh__HG_PTHREAD_MUTEX_LOCK_POST(tid, slock);   7347   evh__HG_PTHREAD_MUTEX_LOCK_POST(tid, slock);
7348   return;   7348   return;
7349 }   7349 }
7350 }   7350 }
7351 static void evh__HG_PTHREAD_SPIN_DESTROY_PRE(ThreadId tid , void *slock )   7351 static void evh__HG_PTHREAD_SPIN_DESTROY_PRE(ThreadId tid , void *slock )
7352 {   7352 {
7353     7353  
7354     7354  
7355   {   7355   {
7356   evh__HG_PTHREAD_MUTEX_DESTROY_PRE(tid, slock);   7356   evh__HG_PTHREAD_MUTEX_DESTROY_PRE(tid, slock);
7357   return;   7357   return;
7358 }   7358 }
7359 }   7359 }
7360 static WordFM *map_cond_to_CVInfo  =    (WordFM *)((void *)0);   7360 static WordFM *map_cond_to_CVInfo  =    (WordFM *)((void *)0);
7361 static void map_cond_to_CVInfo_INIT(void)   7361 static void map_cond_to_CVInfo_INIT(void)
7362 {   7362 {
7363   long tmp ;   7363   long tmp ;
7364     7364  
7365   {   7365   {
7366   tmp = __builtin_expect((long )((unsigned int )map_cond_to_CVInfo == (unsigned int )((void *)0)),   7366   tmp = __builtin_expect((long )((unsigned int )map_cond_to_CVInfo == (unsigned int )((void *)0)),
7367                          0L);   7367                          0L);
7368   if (tmp) {   7368   if (tmp) {
7369     map_cond_to_CVInfo = vgPlain_newFM(& vgHelgrind_zalloc,   7369     map_cond_to_CVInfo = vgPlain_newFM(& vgHelgrind_zalloc,
7370                                        (HChar *)"hg.mctCI.1", & vgHelgrind_free,   7370                                        (HChar *)"hg.mctCI.1", & vgHelgrind_free,
7371                                        (Word (*)(UWord  , UWord  ))((void *)0));   7371                                        (Word (*)(UWord  , UWord  ))((void *)0));
7372     if ((unsigned int )map_cond_to_CVInfo != (unsigned int )((void *)0)) {   7372     if ((unsigned int )map_cond_to_CVInfo != (unsigned int )((void *)0)) {
7373     7373  
7374     } else {   7374     } else {
7375       vgPlain_assert_fail((Bool )0,   7375       vgPlain_assert_fail((Bool )0,
7376                           (Char const   *)"map_cond_to_CVInfo != NULL",   7376                           (Char const   *)"map_cond_to_CVInfo != NULL",
7377                           (Char const   *)"hg_main.c", 2055,   7377                           (Char const   *)"hg_main.c", 2055,
7378                           (Char const   *)"map_cond_to_CVInfo_INIT", "");   7378                           (Char const   *)"map_cond_to_CVInfo_INIT", "");
7379     }   7379     }
7380   } else {   7380   } else {
7381     7381  
7382   }   7382   }
7383   return;   7383   return;
7384 }   7384 }
7385 }   7385 }
7386 static CVInfo *map_cond_to_CVInfo_lookup_or_alloc(void *cond )   7386 static CVInfo *map_cond_to_CVInfo_lookup_or_alloc(void *cond )
7387 {   7387 {
7388   UWord key ;   7388   UWord key ;
7389   UWord val ;   7389   UWord val ;
7390   SO *so ;   7390   SO *so ;
7391   SO *tmp ;   7391   SO *tmp ;
7392   CVInfo *cvi ;   7392   CVInfo *cvi ;
7393   void *tmp___0 ;   7393   void *tmp___0 ;
7394   Bool tmp___1 ;   7394   Bool tmp___1 ;
7395     7395  
7396   {   7396   {
7397   map_cond_to_CVInfo_INIT();   7397   map_cond_to_CVInfo_INIT();
7398   tmp___1 = vgPlain_lookupFM(map_cond_to_CVInfo, & key, & val, (UWord )cond);   7398   tmp___1 = vgPlain_lookupFM(map_cond_to_CVInfo, & key, & val, (UWord )cond);
7399   if (tmp___1) {   7399   if (tmp___1) {
7400     if (key == (UWord )cond) {   7400     if (key == (UWord )cond) {
7401     7401  
7402     } else {   7402     } else {
7403       vgPlain_assert_fail((Bool )0, (Char const   *)"key == (UWord)cond",   7403       vgPlain_assert_fail((Bool )0, (Char const   *)"key == (UWord)cond",
7404                           (Char const   *)"hg_main.c", 2063,   7404                           (Char const   *)"hg_main.c", 2063,
7405                           (Char const   *)"map_cond_to_CVInfo_lookup_or_alloc",   7405                           (Char const   *)"map_cond_to_CVInfo_lookup_or_alloc",
7406                           "");   7406                           "");
7407     }   7407     }
7408     return ((CVInfo *)val);   7408     return ((CVInfo *)val);
7409   } else {   7409   } else {
7410     tmp = libhb_so_alloc();   7410     tmp = libhb_so_alloc();
7411     so = tmp;   7411     so = tmp;
7412     tmp___0 = vgHelgrind_zalloc((HChar *)"hg.mctCloa.1", (SizeT )sizeof(CVInfo ));   7412     tmp___0 = vgHelgrind_zalloc((HChar *)"hg.mctCloa.1", (SizeT )sizeof(CVInfo ));
7413     cvi = (CVInfo *)tmp___0;   7413     cvi = (CVInfo *)tmp___0;
7414     cvi->so = so;   7414     cvi->so = so;
7415     cvi->mx_ga = (void *)0;   7415     cvi->mx_ga = (void *)0;
7416     vgPlain_addToFM(map_cond_to_CVInfo, (UWord )cond, (UWord )cvi);   7416     vgPlain_addToFM(map_cond_to_CVInfo, (UWord )cond, (UWord )cvi);
7417     return (cvi);   7417     return (cvi);
7418   }   7418   }
7419 }   7419 }
7420 }   7420 }
7421 static void map_cond_to_CVInfo_delete(void *cond )   7421 static void map_cond_to_CVInfo_delete(void *cond )
7422 {   7422 {
7423   UWord keyW ;   7423   UWord keyW ;
7424   UWord valW ;   7424   UWord valW ;
7425   CVInfo *cvi ;   7425   CVInfo *cvi ;
7426   Bool tmp ;   7426   Bool tmp ;
7427     7427  
7428   {   7428   {
7429   map_cond_to_CVInfo_INIT();   7429   map_cond_to_CVInfo_INIT();
7430   tmp = vgPlain_delFromFM(map_cond_to_CVInfo, & keyW, & valW, (UWord )cond);   7430   tmp = vgPlain_delFromFM(map_cond_to_CVInfo, & keyW, & valW, (UWord )cond);
7431   if (tmp) {   7431   if (tmp) {
7432     cvi = (CVInfo *)valW;   7432     cvi = (CVInfo *)valW;
7433     if (keyW == (UWord )cond) {   7433     if (keyW == (UWord )cond) {
7434     7434  
7435     } else {   7435     } else {
7436       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (UWord)cond",   7436       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (UWord)cond",
7437                           (Char const   *)"hg_main.c", 2080,   7437                           (Char const   *)"hg_main.c", 2080,
7438                           (Char const   *)"map_cond_to_CVInfo_delete", "");   7438                           (Char const   *)"map_cond_to_CVInfo_delete", "");
7439     }   7439     }
7440     if (cvi) {   7440     if (cvi) {
7441     7441  
7442     } else {   7442     } else {
7443       vgPlain_assert_fail((Bool )0, (Char const   *)"cvi",   7443       vgPlain_assert_fail((Bool )0, (Char const   *)"cvi",
7444                           (Char const   *)"hg_main.c", 2081,   7444                           (Char const   *)"hg_main.c", 2081,
7445                           (Char const   *)"map_cond_to_CVInfo_delete", "");   7445                           (Char const   *)"map_cond_to_CVInfo_delete", "");
7446     }   7446     }
7447     if (cvi->so) {   7447     if (cvi->so) {
7448     7448  
7449     } else {   7449     } else {
7450       vgPlain_assert_fail((Bool )0, (Char const   *)"cvi->so",   7450       vgPlain_assert_fail((Bool )0, (Char const   *)"cvi->so",
7451                           (Char const   *)"hg_main.c", 2082,   7451                           (Char const   *)"hg_main.c", 2082,
7452                           (Char const   *)"map_cond_to_CVInfo_delete", "");   7452                           (Char const   *)"map_cond_to_CVInfo_delete", "");
7453     }   7453     }
7454     libhb_so_dealloc(cvi->so);   7454     libhb_so_dealloc(cvi->so);
7455     cvi->mx_ga = (void *)0;   7455     cvi->mx_ga = (void *)0;
7456     vgHelgrind_free((void *)cvi);   7456     vgHelgrind_free((void *)cvi);
7457   } else {   7457   } else {
7458     7458  
7459   }   7459   }
7460   return;   7460   return;
7461 }   7461 }
7462 }   7462 }
7463 static void evh__HG_PTHREAD_COND_SIGNAL_PRE(ThreadId tid , void *cond )   7463 static void evh__HG_PTHREAD_COND_SIGNAL_PRE(ThreadId tid , void *cond )
7464 {   7464 {
7465   Thread *thr ;   7465   Thread *thr ;
7466   CVInfo *cvi ;   7466   CVInfo *cvi ;
7467     7467  
7468   {   7468   {
7469   thr = map_threads_maybe_lookup(tid);   7469   thr = map_threads_maybe_lookup(tid);
7470   if (thr) {   7470   if (thr) {
7471     7471  
7472   } else {   7472   } else {
7473     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   7473     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
7474                         (Char const   *)"hg_main.c", 2106,   7474                         (Char const   *)"hg_main.c", 2106,
7475                         (Char const   *)"evh__HG_PTHREAD_COND_SIGNAL_PRE", "");   7475                         (Char const   *)"evh__HG_PTHREAD_COND_SIGNAL_PRE", "");
7476   }   7476   }
7477   cvi = map_cond_to_CVInfo_lookup_or_alloc(cond);   7477   cvi = map_cond_to_CVInfo_lookup_or_alloc(cond);
7478   if (cvi) {   7478   if (cvi) {
7479     7479  
7480   } else {   7480   } else {
7481     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi",   7481     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi",
7482                         (Char const   *)"hg_main.c", 2109,   7482                         (Char const   *)"hg_main.c", 2109,
7483                         (Char const   *)"evh__HG_PTHREAD_COND_SIGNAL_PRE", "");   7483                         (Char const   *)"evh__HG_PTHREAD_COND_SIGNAL_PRE", "");
7484   }   7484   }
7485   if (cvi->so) {   7485   if (cvi->so) {
7486     7486  
7487   } else {   7487   } else {
7488     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi->so",   7488     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi->so",
7489                         (Char const   *)"hg_main.c", 2110,   7489                         (Char const   *)"hg_main.c", 2110,
7490                         (Char const   *)"evh__HG_PTHREAD_COND_SIGNAL_PRE", "");   7490                         (Char const   *)"evh__HG_PTHREAD_COND_SIGNAL_PRE", "");
7491   }   7491   }
7492   libhb_so_send(thr->hbthr, cvi->so, (Bool )1);   7492   libhb_so_send(thr->hbthr, cvi->so, (Bool )1);
7493   return;   7493   return;
7494 }   7494 }
7495 }   7495 }
7496 static Bool evh__HG_PTHREAD_COND_WAIT_PRE(ThreadId tid , void *cond ,   7496 static Bool evh__HG_PTHREAD_COND_WAIT_PRE(ThreadId tid , void *cond ,
7497                                           void *mutex )   7497                                           void *mutex )
7498 {   7498 {
7499   Thread *thr ;   7499   Thread *thr ;
7500   Lock *lk ;   7500   Lock *lk ;
7501   Bool lk_valid ;   7501   Bool lk_valid ;
7502   CVInfo *cvi ;   7502   CVInfo *cvi ;
7503   Bool tmp ;   7503   Bool tmp ;
7504   UWord tmp___0 ;   7504   UWord tmp___0 ;
7505     7505  
7506   {   7506   {
7507   lk_valid = (Bool )1;   7507   lk_valid = (Bool )1;
7508   thr = map_threads_maybe_lookup(tid);   7508   thr = map_threads_maybe_lookup(tid);
7509   if (thr) {   7509   if (thr) {
7510     7510  
7511   } else {   7511   } else {
7512     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   7512     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
7513                         (Char const   *)"hg_main.c", 2163,   7513                         (Char const   *)"hg_main.c", 2163,
7514                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_PRE", "");   7514                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_PRE", "");
7515   }   7515   }
7516   lk = map_locks_maybe_lookup((Addr )mutex);   7516   lk = map_locks_maybe_lookup((Addr )mutex);
7517   if ((unsigned int )lk == (unsigned int )((void *)0)) {   7517   if ((unsigned int )lk == (unsigned int )((void *)0)) {
7518     lk_valid = (Bool )0;   7518     lk_valid = (Bool )0;
7519     vgHelgrind_record_error_Misc(thr,   7519     vgHelgrind_record_error_Misc(thr,
7520                                  (HChar *)"pthread_cond_{timed}wait called with invalid mutex");   7520                                  (HChar *)"pthread_cond_{timed}wait called with invalid mutex");
7521   } else {   7521   } else {
7522     tmp = vgHelgrind_is_sane_LockN(lk);   7522     tmp = vgHelgrind_is_sane_LockN(lk);
7523     if (tmp) {   7523     if (tmp) {
7524     7524  
7525     } else {   7525     } else {
7526       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   7526       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
7527                           (Char const   *)"hg_main.c", 2176,   7527                           (Char const   *)"hg_main.c", 2176,
7528                           (Char const   *)"evh__HG_PTHREAD_COND_WAIT_PRE", "");   7528                           (Char const   *)"evh__HG_PTHREAD_COND_WAIT_PRE", "");
7529     }   7529     }
7530     if ((unsigned int )lk->kind == 1003U) {   7530     if ((unsigned int )lk->kind == 1003U) {
7531       lk_valid = (Bool )0;   7531       lk_valid = (Bool )0;
7532       vgHelgrind_record_error_Misc(thr,   7532       vgHelgrind_record_error_Misc(thr,
7533                                    (HChar *)"pthread_cond_{timed}wait called with mutex of type pthread_rwlock_t*");   7533                                    (HChar *)"pthread_cond_{timed}wait called with mutex of type pthread_rwlock_t*");
7534     } else   7534     } else
7535     if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {   7535     if ((unsigned int )lk->heldBy == (unsigned int )((void *)0)) {
7536       lk_valid = (Bool )0;   7536       lk_valid = (Bool )0;
7537       vgHelgrind_record_error_Misc(thr,   7537       vgHelgrind_record_error_Misc(thr,
7538                                    (HChar *)"pthread_cond_{timed}wait called with un-held mutex");   7538                                    (HChar *)"pthread_cond_{timed}wait called with un-held mutex");
7539     } else   7539     } else
7540     if ((unsigned int )lk->heldBy != (unsigned int )((void *)0)) {   7540     if ((unsigned int )lk->heldBy != (unsigned int )((void *)0)) {
7541       tmp___0 = vgPlain_elemBag(lk->heldBy, (UWord )((Word )thr));   7541       tmp___0 = vgPlain_elemBag(lk->heldBy, (UWord )((Word )thr));
7542       if (tmp___0 == 0UL) {   7542       if (tmp___0 == 0UL) {
7543         lk_valid = (Bool )0;   7543         lk_valid = (Bool )0;
7544         vgHelgrind_record_error_Misc(thr,   7544         vgHelgrind_record_error_Misc(thr,
7545                                      (HChar *)"pthread_cond_{timed}wait called with mutex held by a different thread");   7545                                      (HChar *)"pthread_cond_{timed}wait called with mutex held by a different thread");
7546       } else {   7546       } else {
7547     7547  
7548       }   7548       }
7549     } else {   7549     } else {
7550     7550  
7551     }   7551     }
7552   }   7552   }
7553   cvi = map_cond_to_CVInfo_lookup_or_alloc(cond);   7553   cvi = map_cond_to_CVInfo_lookup_or_alloc(cond);
7554   if (cvi) {   7554   if (cvi) {
7555     7555  
7556   } else {   7556   } else {
7557     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi",   7557     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi",
7558                         (Char const   *)"hg_main.c", 2199,   7558                         (Char const   *)"hg_main.c", 2199,
7559                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_PRE", "");   7559                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_PRE", "");
7560   }   7560   }
7561   if (cvi->so) {   7561   if (cvi->so) {
7562     7562  
7563   } else {   7563   } else {
7564     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi->so",   7564     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi->so",
7565                         (Char const   *)"hg_main.c", 2200,   7565                         (Char const   *)"hg_main.c", 2200,
7566                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_PRE", "");   7566                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_PRE", "");
7567   }   7567   }
7568   if (cvi->nWaiters == 0UL) {   7568   if (cvi->nWaiters == 0UL) {
7569     cvi->mx_ga = mutex;   7569     cvi->mx_ga = mutex;
7570   } else   7570   } else
7571   if ((unsigned int )cvi->mx_ga != (unsigned int )mutex) {   7571   if ((unsigned int )cvi->mx_ga != (unsigned int )mutex) {
7572     vgHelgrind_record_error_Misc(thr,   7572     vgHelgrind_record_error_Misc(thr,
7573                                  (HChar *)"pthread_cond_{timed}wait: cond is associated with a different mutex");   7573                                  (HChar *)"pthread_cond_{timed}wait: cond is associated with a different mutex");
7574   } else {   7574   } else {
7575     7575  
7576   }   7576   }
7577   (cvi->nWaiters) ++;   7577   (cvi->nWaiters) ++;
7578   return (lk_valid);   7578   return (lk_valid);
7579 }   7579 }
7580 }   7580 }
7581 static void evh__HG_PTHREAD_COND_WAIT_POST(ThreadId tid , void *cond ,   7581 static void evh__HG_PTHREAD_COND_WAIT_POST(ThreadId tid , void *cond ,
7582                                            void *mutex )   7582                                            void *mutex )
7583 {   7583 {
7584   Thread *thr ;   7584   Thread *thr ;
7585   CVInfo *cvi ;   7585   CVInfo *cvi ;
7586   Bool tmp ;   7586   Bool tmp ;
7587     7587  
7588   {   7588   {
7589   thr = map_threads_maybe_lookup(tid);   7589   thr = map_threads_maybe_lookup(tid);
7590   if (thr) {   7590   if (thr) {
7591     7591  
7592   } else {   7592   } else {
7593     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   7593     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
7594                         (Char const   *)"hg_main.c", 2231,   7594                         (Char const   *)"hg_main.c", 2231,
7595                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_POST", "");   7595                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_POST", "");
7596   }   7596   }
7597   cvi = map_cond_to_CVInfo_lookup_or_alloc(cond);   7597   cvi = map_cond_to_CVInfo_lookup_or_alloc(cond);
7598   if (cvi) {   7598   if (cvi) {
7599     7599  
7600   } else {   7600   } else {
7601     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi",   7601     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi",
7602                         (Char const   *)"hg_main.c", 2236,   7602                         (Char const   *)"hg_main.c", 2236,
7603                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_POST", "");   7603                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_POST", "");
7604   }   7604   }
7605   if (cvi->so) {   7605   if (cvi->so) {
7606     7606  
7607   } else {   7607   } else {
7608     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi->so",   7608     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi->so",
7609                         (Char const   *)"hg_main.c", 2237,   7609                         (Char const   *)"hg_main.c", 2237,
7610                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_POST", "");   7610                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_POST", "");
7611   }   7611   }
7612   if (cvi->nWaiters > 0UL) {   7612   if (cvi->nWaiters > 0UL) {
7613     7613  
7614   } else {   7614   } else {
7615     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi->nWaiters > 0",   7615     vgPlain_assert_fail((Bool )0, (Char const   *)"cvi->nWaiters > 0",
7616                         (Char const   *)"hg_main.c", 2238,   7616                         (Char const   *)"hg_main.c", 2238,
7617                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_POST", "");   7617                         (Char const   *)"evh__HG_PTHREAD_COND_WAIT_POST", "");
7618   }   7618   }
7619   tmp = libhb_so_everSent(cvi->so);   7619   tmp = libhb_so_everSent(cvi->so);
7620   if (tmp) {   7620   if (tmp) {
7621     7621  
7622   } else {   7622   } else {
7623     vgHelgrind_record_error_Misc(thr,   7623     vgHelgrind_record_error_Misc(thr,
7624                                  (HChar *)"Bug in libpthread: pthread_cond_wait succeeded on without prior pthread_cond_post");   7624                                  (HChar *)"Bug in libpthread: pthread_cond_wait succeeded on without prior pthread_cond_post");
7625   }   7625   }
7626   libhb_so_recv(thr->hbthr, cvi->so, (Bool )1);   7626   libhb_so_recv(thr->hbthr, cvi->so, (Bool )1);
7627   (cvi->nWaiters) --;   7627   (cvi->nWaiters) --;
7628   return;   7628   return;
7629 }   7629 }
7630 }   7630 }
7631 static void evh__HG_PTHREAD_COND_DESTROY_PRE(ThreadId tid , void *cond )   7631 static void evh__HG_PTHREAD_COND_DESTROY_PRE(ThreadId tid , void *cond )
7632 {   7632 {
7633     7633  
7634     7634  
7635   {   7635   {
7636   map_cond_to_CVInfo_delete(cond);   7636   map_cond_to_CVInfo_delete(cond);
7637   return;   7637   return;
7638 }   7638 }
7639 }   7639 }
7640 static void evh__HG_PTHREAD_RWLOCK_INIT_POST(ThreadId tid , void *rwl )   7640 static void evh__HG_PTHREAD_RWLOCK_INIT_POST(ThreadId tid , void *rwl )
7641 {   7641 {
7642     7642  
7643     7643  
7644   {   7644   {
7645   map_locks_lookup_or_create((LockKind )1003, (Addr )rwl, tid);   7645   map_locks_lookup_or_create((LockKind )1003, (Addr )rwl, tid);
7646   if (vgHelgrind_clo_sanity_flags & (long )(1 << 1)) {   7646   if (vgHelgrind_clo_sanity_flags & (long )(1 << 1)) {
7647     all__sanity_check((Char *)"evh__hg_PTHREAD_RWLOCK_INIT_POST");   7647     all__sanity_check((Char *)"evh__hg_PTHREAD_RWLOCK_INIT_POST");
7648   } else {   7648   } else {
7649     7649  
7650   }   7650   }
7651   return;   7651   return;
7652 }   7652 }
7653 }   7653 }
7654 static void evh__HG_PTHREAD_RWLOCK_DESTROY_PRE(ThreadId tid , void *rwl )   7654 static void evh__HG_PTHREAD_RWLOCK_DESTROY_PRE(ThreadId tid , void *rwl )
7655 {   7655 {
7656   Thread *thr ;   7656   Thread *thr ;
7657   Lock *lk ;   7657   Lock *lk ;
7658   Bool tmp ;   7658   Bool tmp ;
7659   Bool tmp___0 ;   7659   Bool tmp___0 ;
7660   Bool tmp___1 ;   7660   Bool tmp___1 ;
7661     7661  
7662   {   7662   {
7663   thr = map_threads_maybe_lookup(tid);   7663   thr = map_threads_maybe_lookup(tid);
7664   tmp = vgHelgrind_is_sane_Thread(thr);   7664   tmp = vgHelgrind_is_sane_Thread(thr);
7665   if (tmp) {   7665   if (tmp) {
7666     7666  
7667   } else {   7667   } else {
7668     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",   7668     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_Thread)(thr)",
7669                         (Char const   *)"hg_main.c", 2297,   7669                         (Char const   *)"hg_main.c", 2297,
7670                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_DESTROY_PRE", "");   7670                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_DESTROY_PRE", "");
7671   }   7671   }
7672   lk = map_locks_maybe_lookup((Addr )rwl);   7672   lk = map_locks_maybe_lookup((Addr )rwl);
7673   if ((unsigned int )lk == (unsigned int )((void *)0)) {   7673   if ((unsigned int )lk == (unsigned int )((void *)0)) {
7674     vgHelgrind_record_error_Misc(thr,   7674     vgHelgrind_record_error_Misc(thr,
7675                                  (HChar *)"pthread_rwlock_destroy with invalid argument");   7675                                  (HChar *)"pthread_rwlock_destroy with invalid argument");
7676   } else   7676   } else
7677   if ((unsigned int )lk->kind != 1003U) {   7677   if ((unsigned int )lk->kind != 1003U) {
7678     vgHelgrind_record_error_Misc(thr,   7678     vgHelgrind_record_error_Misc(thr,
7679                                  (HChar *)"pthread_rwlock_destroy with invalid argument");   7679                                  (HChar *)"pthread_rwlock_destroy with invalid argument");
7680   } else {   7680   } else {
7681     7681  
7682   }   7682   }
7683   if (lk) {   7683   if (lk) {
7684     tmp___0 = vgHelgrind_is_sane_LockN(lk);   7684     tmp___0 = vgHelgrind_is_sane_LockN(lk);
7685     if (tmp___0) {   7685     if (tmp___0) {
7686     7686  
7687     } else {   7687     } else {
7688       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   7688       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
7689                           (Char const   *)"hg_main.c", 2307,   7689                           (Char const   *)"hg_main.c", 2307,
7690                           (Char const   *)"evh__HG_PTHREAD_RWLOCK_DESTROY_PRE",   7690                           (Char const   *)"evh__HG_PTHREAD_RWLOCK_DESTROY_PRE",
7691                           "");   7691                           "");
7692     }   7692     }
7693     if (lk->guestaddr == (Addr )rwl) {   7693     if (lk->guestaddr == (Addr )rwl) {
7694     7694  
7695     } else {   7695     } else {
7696       vgPlain_assert_fail((Bool )0,   7696       vgPlain_assert_fail((Bool )0,
7697                           (Char const   *)"lk->guestaddr == (Addr)rwl",   7697                           (Char const   *)"lk->guestaddr == (Addr)rwl",
7698                           (Char const   *)"hg_main.c", 2308,   7698                           (Char const   *)"hg_main.c", 2308,
7699                           (Char const   *)"evh__HG_PTHREAD_RWLOCK_DESTROY_PRE",   7699                           (Char const   *)"evh__HG_PTHREAD_RWLOCK_DESTROY_PRE",
7700                           "");   7700                           "");
7701     }   7701     }
7702     if (lk->heldBy) {   7702     if (lk->heldBy) {
7703       vgHelgrind_record_error_Misc(thr,   7703       vgHelgrind_record_error_Misc(thr,
7704                                    (HChar *)"pthread_rwlock_destroy of a locked mutex");   7704                                    (HChar *)"pthread_rwlock_destroy of a locked mutex");
7705       remove_Lock_from_locksets_of_all_owning_Threads(lk);   7705       remove_Lock_from_locksets_of_all_owning_Threads(lk);
7706       vgPlain_deleteBag(lk->heldBy);   7706       vgPlain_deleteBag(lk->heldBy);
7707       lk->heldBy = (WordBag *)((void *)0);   7707       lk->heldBy = (WordBag *)((void *)0);
7708       lk->heldW = (Bool )0;   7708       lk->heldW = (Bool )0;
7709       lk->acquired_at = (ExeContext *)((void *)0);   7709       lk->acquired_at = (ExeContext *)((void *)0);
7710     } else {   7710     } else {
7711     7711  
7712     }   7712     }
7713     if (! lk->heldBy) {   7713     if (! lk->heldBy) {
7714     7714  
7715     } else {   7715     } else {
7716       vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldBy",   7716       vgPlain_assert_fail((Bool )0, (Char const   *)"!lk->heldBy",
7717                           (Char const   *)"hg_main.c", 2320,   7717                           (Char const   *)"hg_main.c", 2320,
7718                           (Char const   *)"evh__HG_PTHREAD_RWLOCK_DESTROY_PRE",   7718                           (Char const   *)"evh__HG_PTHREAD_RWLOCK_DESTROY_PRE",
7719                           "");   7719                           "");
7720     }   7720     }
7721     tmp___1 = vgHelgrind_is_sane_LockN(lk);   7721     tmp___1 = vgHelgrind_is_sane_LockN(lk);
7722     if (tmp___1) {   7722     if (tmp___1) {
7723     7723  
7724     } else {   7724     } else {
7725       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",   7725       vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(is_sane_LockN)(lk)",
7726                           (Char const   *)"hg_main.c", 2321,   7726                           (Char const   *)"hg_main.c", 2321,
7727                           (Char const   *)"evh__HG_PTHREAD_RWLOCK_DESTROY_PRE",   7727                           (Char const   *)"evh__HG_PTHREAD_RWLOCK_DESTROY_PRE",
7728                           "");   7728                           "");
7729     }   7729     }
7730     if (vgHelgrind_clo_track_lockorders) {   7730     if (vgHelgrind_clo_track_lockorders) {
7731       laog__handle_one_lock_deletion(lk);   7731       laog__handle_one_lock_deletion(lk);
7732     } else {   7732     } else {
7733     7733  
7734     }   7734     }
7735     map_locks_delete(lk->guestaddr);   7735     map_locks_delete(lk->guestaddr);
7736     del_LockN(lk);   7736     del_LockN(lk);
7737   } else {   7737   } else {
7738     7738  
7739   }   7739   }
7740   if (vgHelgrind_clo_sanity_flags & (long )(1 << 1)) {   7740   if (vgHelgrind_clo_sanity_flags & (long )(1 << 1)) {
7741     all__sanity_check((Char *)"evh__hg_PTHREAD_RWLOCK_DESTROY_PRE");   7741     all__sanity_check((Char *)"evh__hg_PTHREAD_RWLOCK_DESTROY_PRE");
7742   } else {   7742   } else {
7743     7743  
7744   }   7744   }
7745   return;   7745   return;
7746 }   7746 }
7747 }   7747 }
7748 static void evh__HG_PTHREAD_RWLOCK_LOCK_PRE(ThreadId tid , void *rwl ,   7748 static void evh__HG_PTHREAD_RWLOCK_LOCK_PRE(ThreadId tid , void *rwl ,
7749                                             Word isW , Word isTryLock )   7749                                             Word isW , Word isTryLock )
7750 {   7750 {
7751   Thread *thr ;   7751   Thread *thr ;
7752   Lock *lk ;   7752   Lock *lk ;
7753     7753  
7754   {   7754   {
7755   if (isW == 0L) {   7755   if (isW == 0L) {
7756     7756  
7757   } else   7757   } else
7758   if (isW == 1L) {   7758   if (isW == 1L) {
7759     7759  
7760   } else {   7760   } else {
7761     vgPlain_assert_fail((Bool )0, (Char const   *)"isW == 0 || isW == 1",   7761     vgPlain_assert_fail((Bool )0, (Char const   *)"isW == 0 || isW == 1",
7762                         (Char const   *)"hg_main.c", 2346,   7762                         (Char const   *)"hg_main.c", 2346,
7763                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_LOCK_PRE", "");   7763                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_LOCK_PRE", "");
7764   }   7764   }
7765   if (isTryLock == 0L) {   7765   if (isTryLock == 0L) {
7766     7766  
7767   } else   7767   } else
7768   if (isTryLock == 1L) {   7768   if (isTryLock == 1L) {
7769     7769  
7770   } else {   7770   } else {
7771     vgPlain_assert_fail((Bool )0,   7771     vgPlain_assert_fail((Bool )0,
7772                         (Char const   *)"isTryLock == 0 || isTryLock == 1",   7772                         (Char const   *)"isTryLock == 0 || isTryLock == 1",
7773                         (Char const   *)"hg_main.c", 2347,   7773                         (Char const   *)"hg_main.c", 2347,
7774                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_LOCK_PRE", "");   7774                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_LOCK_PRE", "");
7775   }   7775   }
7776   thr = map_threads_maybe_lookup(tid);   7776   thr = map_threads_maybe_lookup(tid);
7777   if (thr) {   7777   if (thr) {
7778     7778  
7779   } else {   7779   } else {
7780     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   7780     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
7781                         (Char const   *)"hg_main.c", 2349,   7781                         (Char const   *)"hg_main.c", 2349,
7782                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_LOCK_PRE", "");   7782                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_LOCK_PRE", "");
7783   }   7783   }
7784   lk = map_locks_maybe_lookup((Addr )rwl);   7784   lk = map_locks_maybe_lookup((Addr )rwl);
7785   if (lk) {   7785   if (lk) {
7786     if ((unsigned int )lk->kind == 1002U) {   7786     if ((unsigned int )lk->kind == 1002U) {
7787       vgHelgrind_record_error_Misc(thr,   7787       vgHelgrind_record_error_Misc(thr,
7788                                    (HChar *)"pthread_rwlock_{rd,rw}lock with a pthread_mutex_t* argument ");   7788                                    (HChar *)"pthread_rwlock_{rd,rw}lock with a pthread_mutex_t* argument ");
7789     } else   7789     } else
7790     if ((unsigned int )lk->kind == 1001U) {   7790     if ((unsigned int )lk->kind == 1001U) {
7791       vgHelgrind_record_error_Misc(thr,   7791       vgHelgrind_record_error_Misc(thr,
7792                                    (HChar *)"pthread_rwlock_{rd,rw}lock with a pthread_mutex_t* argument ");   7792                                    (HChar *)"pthread_rwlock_{rd,rw}lock with a pthread_mutex_t* argument ");
7793     } else {   7793     } else {
7794     7794  
7795     }   7795     }
7796   } else {   7796   } else {
7797     7797  
7798   }   7798   }
7799   return;   7799   return;
7800 }   7800 }
7801 }   7801 }
7802 static void evh__HG_PTHREAD_RWLOCK_LOCK_POST(ThreadId tid , void *rwl ,   7802 static void evh__HG_PTHREAD_RWLOCK_LOCK_POST(ThreadId tid , void *rwl ,
7803                                              Word isW )   7803                                              Word isW )
7804 {   7804 {
7805   Thread *thr ;   7805   Thread *thr ;
7806   void (*tmp)(Thread *thr , LockKind lkk , Addr lock_ga ) ;   7806   void (*tmp)(Thread *thr , LockKind lkk , Addr lock_ga ) ;
7807     7807  
7808   {   7808   {
7809   if (isW == 0L) {   7809   if (isW == 0L) {
7810     7810  
7811   } else   7811   } else
7812   if (isW == 1L) {   7812   if (isW == 1L) {
7813     7813  
7814   } else {   7814   } else {
7815     vgPlain_assert_fail((Bool )0, (Char const   *)"isW == 0 || isW == 1",   7815     vgPlain_assert_fail((Bool )0, (Char const   *)"isW == 0 || isW == 1",
7816                         (Char const   *)"hg_main.c", 2370,   7816                         (Char const   *)"hg_main.c", 2370,
7817                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_LOCK_POST", "");   7817                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_LOCK_POST", "");
7818   }   7818   }
7819   thr = map_threads_maybe_lookup(tid);   7819   thr = map_threads_maybe_lookup(tid);
7820   if (thr) {   7820   if (thr) {
7821     7821  
7822   } else {   7822   } else {
7823     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   7823     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
7824                         (Char const   *)"hg_main.c", 2372,   7824                         (Char const   *)"hg_main.c", 2372,
7825                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_LOCK_POST", "");   7825                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_LOCK_POST", "");
7826   }   7826   }
7827   if (isW) {   7827   if (isW) {
7828     tmp = & evhH__post_thread_w_acquires_lock;   7828     tmp = & evhH__post_thread_w_acquires_lock;
7829   } else {   7829   } else {
7830     tmp = & evhH__post_thread_r_acquires_lock;   7830     tmp = & evhH__post_thread_r_acquires_lock;
7831   }   7831   }
7832   (*tmp)(thr, (LockKind )1003, (Addr )rwl);   7832   (*tmp)(thr, (LockKind )1003, (Addr )rwl);
7833   return;   7833   return;
7834 }   7834 }
7835 }   7835 }
7836 static void evh__HG_PTHREAD_RWLOCK_UNLOCK_PRE(ThreadId tid , void *rwl )   7836 static void evh__HG_PTHREAD_RWLOCK_UNLOCK_PRE(ThreadId tid , void *rwl )
7837 {   7837 {
7838   Thread *thr ;   7838   Thread *thr ;
7839     7839  
7840   {   7840   {
7841   thr = map_threads_maybe_lookup(tid);   7841   thr = map_threads_maybe_lookup(tid);
7842   if (thr) {   7842   if (thr) {
7843     7843  
7844   } else {   7844   } else {
7845     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   7845     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
7846                         (Char const   *)"hg_main.c", 2391,   7846                         (Char const   *)"hg_main.c", 2391,
7847                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_UNLOCK_PRE", "");   7847                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_UNLOCK_PRE", "");
7848   }   7848   }
7849   evhH__pre_thread_releases_lock(thr, (Addr )rwl, (Bool )1);   7849   evhH__pre_thread_releases_lock(thr, (Addr )rwl, (Bool )1);
7850   return;   7850   return;
7851 }   7851 }
7852 }   7852 }
7853 static void evh__HG_PTHREAD_RWLOCK_UNLOCK_POST(ThreadId tid , void *rwl )   7853 static void evh__HG_PTHREAD_RWLOCK_UNLOCK_POST(ThreadId tid , void *rwl )
7854 {   7854 {
7855   Thread *thr ;   7855   Thread *thr ;
7856     7856  
7857   {   7857   {
7858   thr = map_threads_maybe_lookup(tid);   7858   thr = map_threads_maybe_lookup(tid);
7859   if (thr) {   7859   if (thr) {
7860     7860  
7861   } else {   7861   } else {
7862     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   7862     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
7863                         (Char const   *)"hg_main.c", 2404,   7863                         (Char const   *)"hg_main.c", 2404,
7864                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_UNLOCK_POST", "");   7864                         (Char const   *)"evh__HG_PTHREAD_RWLOCK_UNLOCK_POST", "");
7865   }   7865   }
7866   return;   7866   return;
7867 }   7867 }
7868 }   7868 }
7869 static WordFM *map_sem_to_SO_stack  =    (WordFM *)((void *)0);   7869 static WordFM *map_sem_to_SO_stack  =    (WordFM *)((void *)0);
7870 static void map_sem_to_SO_stack_INIT(void)   7870 static void map_sem_to_SO_stack_INIT(void)
7871 {   7871 {
7872     7872  
7873     7873  
7874   {   7874   {
7875   if ((unsigned int )map_sem_to_SO_stack == (unsigned int )((void *)0)) {   7875   if ((unsigned int )map_sem_to_SO_stack == (unsigned int )((void *)0)) {
7876     map_sem_to_SO_stack = vgPlain_newFM(& vgHelgrind_zalloc,   7876     map_sem_to_SO_stack = vgPlain_newFM(& vgHelgrind_zalloc,
7877                                         (HChar *)"hg.mstSs.1",   7877                                         (HChar *)"hg.mstSs.1",
7878                                         & vgHelgrind_free,   7878                                         & vgHelgrind_free,
7879                                         (Word (*)(UWord  , UWord  ))((void *)0));   7879                                         (Word (*)(UWord  , UWord  ))((void *)0));
7880     if ((unsigned int )map_sem_to_SO_stack != (unsigned int )((void *)0)) {   7880     if ((unsigned int )map_sem_to_SO_stack != (unsigned int )((void *)0)) {
7881     7881  
7882     } else {   7882     } else {
7883       vgPlain_assert_fail((Bool )0,   7883       vgPlain_assert_fail((Bool )0,
7884                           (Char const   *)"map_sem_to_SO_stack != NULL",   7884                           (Char const   *)"map_sem_to_SO_stack != NULL",
7885                           (Char const   *)"hg_main.c", 2454,   7885                           (Char const   *)"hg_main.c", 2454,
7886                           (Char const   *)"map_sem_to_SO_stack_INIT", "");   7886                           (Char const   *)"map_sem_to_SO_stack_INIT", "");
7887     }   7887     }
7888   } else {   7888   } else {
7889     7889  
7890   }   7890   }
7891   return;   7891   return;
7892 }   7892 }
7893 }   7893 }
7894 static void push_SO_for_sem(void *sem , SO *so )   7894 static void push_SO_for_sem(void *sem , SO *so )
7895 {   7895 {
7896   UWord keyW ;   7896   UWord keyW ;
7897   XArray *xa ;   7897   XArray *xa ;
7898   Bool tmp ;   7898   Bool tmp ;
7899     7899  
7900   {   7900   {
7901   if (so) {   7901   if (so) {
7902     7902  
7903   } else {   7903   } else {
7904     vgPlain_assert_fail((Bool )0, (Char const   *)"so",   7904     vgPlain_assert_fail((Bool )0, (Char const   *)"so",
7905                         (Char const   *)"hg_main.c", 2461,   7905                         (Char const   *)"hg_main.c", 2461,
7906                         (Char const   *)"push_SO_for_sem", "");   7906                         (Char const   *)"push_SO_for_sem", "");
7907   }   7907   }
7908   map_sem_to_SO_stack_INIT();   7908   map_sem_to_SO_stack_INIT();
7909   tmp = vgPlain_lookupFM(map_sem_to_SO_stack, & keyW, (UWord *)(& xa),   7909   tmp = vgPlain_lookupFM(map_sem_to_SO_stack, & keyW, (UWord *)(& xa),
7910                          (UWord )sem);   7910                          (UWord )sem);
7911   if (tmp) {   7911   if (tmp) {
7912     if (keyW == (UWord )sem) {   7912     if (keyW == (UWord )sem) {
7913     7913  
7914     } else {   7914     } else {
7915       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (UWord)sem",   7915       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (UWord)sem",
7916                           (Char const   *)"hg_main.c", 2465,   7916                           (Char const   *)"hg_main.c", 2465,
7917                           (Char const   *)"push_SO_for_sem", "");   7917                           (Char const   *)"push_SO_for_sem", "");
7918     }   7918     }
7919     if (xa) {   7919     if (xa) {
7920     7920  
7921     } else {   7921     } else {
7922       vgPlain_assert_fail((Bool )0, (Char const   *)"xa",   7922       vgPlain_assert_fail((Bool )0, (Char const   *)"xa",
7923                           (Char const   *)"hg_main.c", 2466,   7923                           (Char const   *)"hg_main.c", 2466,
7924                           (Char const   *)"push_SO_for_sem", "");   7924                           (Char const   *)"push_SO_for_sem", "");
7925     }   7925     }
7926     vgPlain_addToXA(xa, (void *)(& so));   7926     vgPlain_addToXA(xa, (void *)(& so));
7927   } else {   7927   } else {
7928     xa = vgPlain_newXA(& vgHelgrind_zalloc, (HChar *)"hg.pSfs.1",   7928     xa = vgPlain_newXA(& vgHelgrind_zalloc, (HChar *)"hg.pSfs.1",
7929                        & vgHelgrind_free, (Word )sizeof(SO *));   7929                        & vgHelgrind_free, (Word )sizeof(SO *));
7930     vgPlain_addToXA(xa, (void *)(& so));   7930     vgPlain_addToXA(xa, (void *)(& so));
7931     vgPlain_addToFM(map_sem_to_SO_stack, (UWord )((Word )sem),   7931     vgPlain_addToFM(map_sem_to_SO_stack, (UWord )((Word )sem),
7932                     (UWord )((Word )xa));   7932                     (UWord )((Word )xa));
7933   }   7933   }
7934   return;   7934   return;
7935 }   7935 }
7936 }   7936 }
7937 static SO *mb_pop_SO_for_sem(void *sem )   7937 static SO *mb_pop_SO_for_sem(void *sem )
7938 {   7938 {
7939   UWord keyW ;   7939   UWord keyW ;
7940   XArray *xa ;   7940   XArray *xa ;
7941   SO *so ;   7941   SO *so ;
7942   Word sz ;   7942   Word sz ;
7943   void *tmp ;   7943   void *tmp ;
7944   Bool tmp___0 ;   7944   Bool tmp___0 ;
7945     7945  
7946   {   7946   {
7947   map_sem_to_SO_stack_INIT();   7947   map_sem_to_SO_stack_INIT();
7948   tmp___0 = vgPlain_lookupFM(map_sem_to_SO_stack, & keyW, (UWord *)(& xa),   7948   tmp___0 = vgPlain_lookupFM(map_sem_to_SO_stack, & keyW, (UWord *)(& xa),
7949                              (UWord )sem);   7949                              (UWord )sem);
7950   if (tmp___0) {   7950   if (tmp___0) {
7951     if (keyW == (UWord )sem) {   7951     if (keyW == (UWord )sem) {
7952     7952  
7953     } else {   7953     } else {
7954       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (UWord)sem",   7954       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (UWord)sem",
7955                           (Char const   *)"hg_main.c", 2484,   7955                           (Char const   *)"hg_main.c", 2484,
7956                           (Char const   *)"mb_pop_SO_for_sem", "");   7956                           (Char const   *)"mb_pop_SO_for_sem", "");
7957     }   7957     }
7958     sz = vgPlain_sizeXA(xa);   7958     sz = vgPlain_sizeXA(xa);
7959     if (sz >= 0L) {   7959     if (sz >= 0L) {
7960     7960  
7961     } else {   7961     } else {
7962       vgPlain_assert_fail((Bool )0, (Char const   *)"sz >= 0",   7962       vgPlain_assert_fail((Bool )0, (Char const   *)"sz >= 0",
7963                           (Char const   *)"hg_main.c", 2486,   7963                           (Char const   *)"hg_main.c", 2486,
7964                           (Char const   *)"mb_pop_SO_for_sem", "");   7964                           (Char const   *)"mb_pop_SO_for_sem", "");
7965     }   7965     }
7966     if (sz == 0L) {   7966     if (sz == 0L) {
7967       return ((SO *)((void *)0));   7967       return ((SO *)((void *)0));
7968     } else {   7968     } else {
7969     7969  
7970     }   7970     }
7971     tmp = vgPlain_indexXA(xa, sz - 1L);   7971     tmp = vgPlain_indexXA(xa, sz - 1L);
7972     so = *((SO **)tmp);   7972     so = *((SO **)tmp);
7973     if (so) {   7973     if (so) {
7974     7974  
7975     } else {   7975     } else {
7976       vgPlain_assert_fail((Bool )0, (Char const   *)"so",   7976       vgPlain_assert_fail((Bool )0, (Char const   *)"so",
7977                           (Char const   *)"hg_main.c", 2490,   7977                           (Char const   *)"hg_main.c", 2490,
7978                           (Char const   *)"mb_pop_SO_for_sem", "");   7978                           (Char const   *)"mb_pop_SO_for_sem", "");
7979     }   7979     }
7980     vgPlain_dropTailXA(xa, (Word )1);   7980     vgPlain_dropTailXA(xa, (Word )1);
7981     return (so);   7981     return (so);
7982   } else {   7982   } else {
7983     return ((SO *)((void *)0));   7983     return ((SO *)((void *)0));
7984   }   7984   }
7985 }   7985 }
7986 }   7986 }
7987 static void evh__HG_POSIX_SEM_DESTROY_PRE(ThreadId tid , void *sem )   7987 static void evh__HG_POSIX_SEM_DESTROY_PRE(ThreadId tid , void *sem )
7988 {   7988 {
7989   UWord keyW ;   7989   UWord keyW ;
7990   UWord valW ;   7990   UWord valW ;
7991   SO *so ;   7991   SO *so ;
7992   XArray *xa ;   7992   XArray *xa ;
7993   Word tmp ;   7993   Word tmp ;
7994   Bool tmp___0 ;   7994   Bool tmp___0 ;
7995     7995  
7996   {   7996   {
7997   map_sem_to_SO_stack_INIT();   7997   map_sem_to_SO_stack_INIT();
7998   while (1) {   7998   while (1) {
7999     so = mb_pop_SO_for_sem(sem);   7999     so = mb_pop_SO_for_sem(sem);
8000     if (! so) {   8000     if (! so) {
8001       break;   8001       break;
8002     } else {   8002     } else {
8003     8003  
8004     }   8004     }
8005     libhb_so_dealloc(so);   8005     libhb_so_dealloc(so);
8006   }   8006   }
8007   tmp___0 = vgPlain_delFromFM(map_sem_to_SO_stack, & keyW, & valW, (UWord )sem);   8007   tmp___0 = vgPlain_delFromFM(map_sem_to_SO_stack, & keyW, & valW, (UWord )sem);
8008   if (tmp___0) {   8008   if (tmp___0) {
8009     xa = (XArray *)valW;   8009     xa = (XArray *)valW;
8010     if (keyW == (UWord )sem) {   8010     if (keyW == (UWord )sem) {
8011     8011  
8012     } else {   8012     } else {
8013       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (UWord)sem",   8013       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (UWord)sem",
8014                           (Char const   *)"hg_main.c", 2520,   8014                           (Char const   *)"hg_main.c", 2520,
8015                           (Char const   *)"evh__HG_POSIX_SEM_DESTROY_PRE", "");   8015                           (Char const   *)"evh__HG_POSIX_SEM_DESTROY_PRE", "");
8016     }   8016     }
8017     if (xa) {   8017     if (xa) {
8018     8018  
8019     } else {   8019     } else {
8020       vgPlain_assert_fail((Bool )0, (Char const   *)"xa",   8020       vgPlain_assert_fail((Bool )0, (Char const   *)"xa",
8021                           (Char const   *)"hg_main.c", 2521,   8021                           (Char const   *)"hg_main.c", 2521,
8022                           (Char const   *)"evh__HG_POSIX_SEM_DESTROY_PRE", "");   8022                           (Char const   *)"evh__HG_POSIX_SEM_DESTROY_PRE", "");
8023     }   8023     }
8024     tmp = vgPlain_sizeXA(xa);   8024     tmp = vgPlain_sizeXA(xa);
8025     if (tmp == 0L) {   8025     if (tmp == 0L) {
8026     8026  
8027     } else {   8027     } else {
8028       vgPlain_assert_fail((Bool )0, (Char const   *)"VG_(sizeXA)(xa) == 0",   8028       vgPlain_assert_fail((Bool )0, (Char const   *)"VG_(sizeXA)(xa) == 0",
8029                           (Char const   *)"hg_main.c", 2522,   8029                           (Char const   *)"hg_main.c", 2522,
8030                           (Char const   *)"evh__HG_POSIX_SEM_DESTROY_PRE", "");   8030                           (Char const   *)"evh__HG_POSIX_SEM_DESTROY_PRE", "");
8031     }   8031     }
8032     vgPlain_deleteXA(xa);   8032     vgPlain_deleteXA(xa);
8033   } else {   8033   } else {
8034     8034  
8035   }   8035   }
8036   return;   8036   return;
8037 }   8037 }
8038 }   8038 }
8039 static void evh__HG_POSIX_SEM_INIT_POST(ThreadId tid , void *sem , UWord value )   8039 static void evh__HG_POSIX_SEM_INIT_POST(ThreadId tid , void *sem , UWord value )
8040 {   8040 {
8041   SO *so ;   8041   SO *so ;
8042   Thread *thr ;   8042   Thread *thr ;
8043   Thr *hbthr ;   8043   Thr *hbthr ;
8044     8044  
8045   {   8045   {
8046   thr = map_threads_maybe_lookup(tid);   8046   thr = map_threads_maybe_lookup(tid);
8047   if (thr) {   8047   if (thr) {
8048     8048  
8049   } else {   8049   } else {
8050     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   8050     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
8051                         (Char const   *)"hg_main.c", 2538,   8051                         (Char const   *)"hg_main.c", 2538,
8052                         (Char const   *)"evh__HG_POSIX_SEM_INIT_POST", "");   8052                         (Char const   *)"evh__HG_POSIX_SEM_INIT_POST", "");
8053   }   8053   }
8054   while (1) {   8054   while (1) {
8055     so = mb_pop_SO_for_sem(sem);   8055     so = mb_pop_SO_for_sem(sem);
8056     if (! so) {   8056     if (! so) {
8057       break;   8057       break;
8058     } else {   8058     } else {
8059     8059  
8060     }   8060     }
8061     libhb_so_dealloc(so);   8061     libhb_so_dealloc(so);
8062   }   8062   }
8063   if (value > 10000UL) {   8063   if (value > 10000UL) {
8064     vgHelgrind_record_error_Misc(thr,   8064     vgHelgrind_record_error_Misc(thr,
8065                                  (HChar *)"sem_init: initial value exceeds 10000; using 10000");   8065                                  (HChar *)"sem_init: initial value exceeds 10000; using 10000");
8066     value = (UWord )10000;   8066     value = (UWord )10000;
8067   } else {   8067   } else {
8068     8068  
8069   }   8069   }
8070   while (value > 0UL) {   8070   while (value > 0UL) {
8071     hbthr = thr->hbthr;   8071     hbthr = thr->hbthr;
8072     if (hbthr) {   8072     if (hbthr) {
8073     8073  
8074     } else {   8074     } else {
8075       vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr",   8075       vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr",
8076                           (Char const   *)"hg_main.c", 2560,   8076                           (Char const   *)"hg_main.c", 2560,
8077                           (Char const   *)"evh__HG_POSIX_SEM_INIT_POST", "");   8077                           (Char const   *)"evh__HG_POSIX_SEM_INIT_POST", "");
8078     }   8078     }
8079     so = libhb_so_alloc();   8079     so = libhb_so_alloc();
8080     libhb_so_send(hbthr, so, (Bool )1);   8080     libhb_so_send(hbthr, so, (Bool )1);
8081     push_SO_for_sem(sem, so);   8081     push_SO_for_sem(sem, so);
8082     value --;   8082     value --;
8083   }   8083   }
8084   return;   8084   return;
8085 }   8085 }
8086 }   8086 }
8087 static void evh__HG_POSIX_SEM_POST_PRE(ThreadId tid , void *sem )   8087 static void evh__HG_POSIX_SEM_POST_PRE(ThreadId tid , void *sem )
8088 {   8088 {
8089   Thread *thr ;   8089   Thread *thr ;
8090   SO *so ;   8090   SO *so ;
8091   Thr *hbthr ;   8091   Thr *hbthr ;
8092     8092  
8093   {   8093   {
8094   thr = map_threads_maybe_lookup(tid);   8094   thr = map_threads_maybe_lookup(tid);
8095   if (thr) {   8095   if (thr) {
8096     8096  
8097   } else {   8097   } else {
8098     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   8098     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
8099                         (Char const   *)"hg_main.c", 2587,   8099                         (Char const   *)"hg_main.c", 2587,
8100                         (Char const   *)"evh__HG_POSIX_SEM_POST_PRE", "");   8100                         (Char const   *)"evh__HG_POSIX_SEM_POST_PRE", "");
8101   }   8101   }
8102   hbthr = thr->hbthr;   8102   hbthr = thr->hbthr;
8103   if (hbthr) {   8103   if (hbthr) {
8104     8104  
8105   } else {   8105   } else {
8106     vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr",   8106     vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr",
8107                         (Char const   *)"hg_main.c", 2592,   8107                         (Char const   *)"hg_main.c", 2592,
8108                         (Char const   *)"evh__HG_POSIX_SEM_POST_PRE", "");   8108                         (Char const   *)"evh__HG_POSIX_SEM_POST_PRE", "");
8109   }   8109   }
8110   so = libhb_so_alloc();   8110   so = libhb_so_alloc();
8111   libhb_so_send(hbthr, so, (Bool )1);   8111   libhb_so_send(hbthr, so, (Bool )1);
8112   push_SO_for_sem(sem, so);   8112   push_SO_for_sem(sem, so);
8113   return;   8113   return;
8114 }   8114 }
8115 }   8115 }
8116 static void evh__HG_POSIX_SEM_WAIT_POST(ThreadId tid , void *sem )   8116 static void evh__HG_POSIX_SEM_WAIT_POST(ThreadId tid , void *sem )
8117 {   8117 {
8118   Thread *thr ;   8118   Thread *thr ;
8119   SO *so ;   8119   SO *so ;
8120   Thr *hbthr ;   8120   Thr *hbthr ;
8121     8121  
8122   {   8122   {
8123   thr = map_threads_maybe_lookup(tid);   8123   thr = map_threads_maybe_lookup(tid);
8124   if (thr) {   8124   if (thr) {
8125     8125  
8126   } else {   8126   } else {
8127     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   8127     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
8128                         (Char const   *)"hg_main.c", 2615,   8128                         (Char const   *)"hg_main.c", 2615,
8129                         (Char const   *)"evh__HG_POSIX_SEM_WAIT_POST", "");   8129                         (Char const   *)"evh__HG_POSIX_SEM_WAIT_POST", "");
8130   }   8130   }
8131   so = mb_pop_SO_for_sem(sem);   8131   so = mb_pop_SO_for_sem(sem);
8132   if (so) {   8132   if (so) {
8133     hbthr = thr->hbthr;   8133     hbthr = thr->hbthr;
8134     if (hbthr) {   8134     if (hbthr) {
8135     8135  
8136     } else {   8136     } else {
8137       vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr",   8137       vgPlain_assert_fail((Bool )0, (Char const   *)"hbthr",
8138                           (Char const   *)"hg_main.c", 2623,   8138                           (Char const   *)"hg_main.c", 2623,
8139                           (Char const   *)"evh__HG_POSIX_SEM_WAIT_POST", "");   8139                           (Char const   *)"evh__HG_POSIX_SEM_WAIT_POST", "");
8140     }   8140     }
8141     libhb_so_recv(hbthr, so, (Bool )1);   8141     libhb_so_recv(hbthr, so, (Bool )1);
8142     libhb_so_dealloc(so);   8142     libhb_so_dealloc(so);
8143   } else {   8143   } else {
8144     vgHelgrind_record_error_Misc(thr,   8144     vgHelgrind_record_error_Misc(thr,
8145                                  (HChar *)"Bug in libpthread: sem_wait succeeded on semaphore without prior sem_post");   8145                                  (HChar *)"Bug in libpthread: sem_wait succeeded on semaphore without prior sem_post");
8146   }   8146   }
8147   return;   8147   return;
8148 }   8148 }
8149 }   8149 }
8150 static Bar *new_Bar(void)   8150 static Bar *new_Bar(void)
8151 {   8151 {
8152   Bar *bar ;   8152   Bar *bar ;
8153   void *tmp ;   8153   void *tmp ;
8154     8154  
8155   {   8155   {
8156   tmp = vgHelgrind_zalloc((HChar *)"hg.nB.1 (new_Bar)", (SizeT )sizeof(Bar ));   8156   tmp = vgHelgrind_zalloc((HChar *)"hg.nB.1 (new_Bar)", (SizeT )sizeof(Bar ));
8157   bar = (Bar *)tmp;   8157   bar = (Bar *)tmp;
8158   if (bar) {   8158   if (bar) {
8159     8159  
8160   } else {   8160   } else {
8161     vgPlain_assert_fail((Bool )0, (Char const   *)"bar",   8161     vgPlain_assert_fail((Bool )0, (Char const   *)"bar",
8162                         (Char const   *)"hg_main.c", 2653,   8162                         (Char const   *)"hg_main.c", 2653,
8163                         (Char const   *)"new_Bar", "");   8163                         (Char const   *)"new_Bar", "");
8164   }   8164   }
8165   if ((int )bar->initted == 0) {   8165   if ((int )bar->initted == 0) {
8166     8166  
8167   } else {   8167   } else {
8168     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->initted == False",   8168     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->initted == False",
8169                         (Char const   *)"hg_main.c", 2655,   8169                         (Char const   *)"hg_main.c", 2655,
8170                         (Char const   *)"new_Bar", "");   8170                         (Char const   *)"new_Bar", "");
8171   }   8171   }
8172   return (bar);   8172   return (bar);
8173 }   8173 }
8174 }   8174 }
8175 static void delete_Bar(Bar *bar )   8175 static void delete_Bar(Bar *bar )
8176 {   8176 {
8177     8177  
8178     8178  
8179   {   8179   {
8180   if (bar) {   8180   if (bar) {
8181     8181  
8182   } else {   8182   } else {
8183     vgPlain_assert_fail((Bool )0, (Char const   *)"bar",   8183     vgPlain_assert_fail((Bool )0, (Char const   *)"bar",
8184                         (Char const   *)"hg_main.c", 2660,   8184                         (Char const   *)"hg_main.c", 2660,
8185                         (Char const   *)"delete_Bar", "");   8185                         (Char const   *)"delete_Bar", "");
8186   }   8186   }
8187   if (bar->waiting) {   8187   if (bar->waiting) {
8188     vgPlain_deleteXA(bar->waiting);   8188     vgPlain_deleteXA(bar->waiting);
8189   } else {   8189   } else {
8190     8190  
8191   }   8191   }
8192   vgHelgrind_free((void *)bar);   8192   vgHelgrind_free((void *)bar);
8193   return;   8193   return;
8194 }   8194 }
8195 }   8195 }
8196 static WordFM *map_barrier_to_Bar  =    (WordFM *)((void *)0);   8196 static WordFM *map_barrier_to_Bar  =    (WordFM *)((void *)0);
8197 static void map_barrier_to_Bar_INIT(void)   8197 static void map_barrier_to_Bar_INIT(void)
8198 {   8198 {
8199   long tmp ;   8199   long tmp ;
8200     8200  
8201   {   8201   {
8202   tmp = __builtin_expect((long )((unsigned int )map_barrier_to_Bar == (unsigned int )((void *)0)),   8202   tmp = __builtin_expect((long )((unsigned int )map_barrier_to_Bar == (unsigned int )((void *)0)),
8203                          0L);   8203                          0L);
8204   if (tmp) {   8204   if (tmp) {
8205     map_barrier_to_Bar = vgPlain_newFM(& vgHelgrind_zalloc,   8205     map_barrier_to_Bar = vgPlain_newFM(& vgHelgrind_zalloc,
8206                                        (HChar *)"hg.mbtBI.1", & vgHelgrind_free,   8206                                        (HChar *)"hg.mbtBI.1", & vgHelgrind_free,
8207                                        (Word (*)(UWord  , UWord  ))((void *)0));   8207                                        (Word (*)(UWord  , UWord  ))((void *)0));
8208     if ((unsigned int )map_barrier_to_Bar != (unsigned int )((void *)0)) {   8208     if ((unsigned int )map_barrier_to_Bar != (unsigned int )((void *)0)) {
8209     8209  
8210     } else {   8210     } else {
8211       vgPlain_assert_fail((Bool )0,   8211       vgPlain_assert_fail((Bool )0,
8212                           (Char const   *)"map_barrier_to_Bar != NULL",   8212                           (Char const   *)"map_barrier_to_Bar != NULL",
8213                           (Char const   *)"hg_main.c", 2675,   8213                           (Char const   *)"hg_main.c", 2675,
8214                           (Char const   *)"map_barrier_to_Bar_INIT", "");   8214                           (Char const   *)"map_barrier_to_Bar_INIT", "");
8215     }   8215     }
8216   } else {   8216   } else {
8217     8217  
8218   }   8218   }
8219   return;   8219   return;
8220 }   8220 }
8221 }   8221 }
8222 static Bar *map_barrier_to_Bar_lookup_or_alloc(void *barrier )   8222 static Bar *map_barrier_to_Bar_lookup_or_alloc(void *barrier )
8223 {   8223 {
8224   UWord key ;   8224   UWord key ;
8225   UWord val ;   8225   UWord val ;
8226   Bar *bar ;   8226   Bar *bar ;
8227   Bar *tmp ;   8227   Bar *tmp ;
8228   Bool tmp___0 ;   8228   Bool tmp___0 ;
8229     8229  
8230   {   8230   {
8231   map_barrier_to_Bar_INIT();   8231   map_barrier_to_Bar_INIT();
8232   tmp___0 = vgPlain_lookupFM(map_barrier_to_Bar, & key, & val, (UWord )barrier);   8232   tmp___0 = vgPlain_lookupFM(map_barrier_to_Bar, & key, & val, (UWord )barrier);
8233   if (tmp___0) {   8233   if (tmp___0) {
8234     if (key == (UWord )barrier) {   8234     if (key == (UWord )barrier) {
8235     8235  
8236     } else {   8236     } else {
8237       vgPlain_assert_fail((Bool )0, (Char const   *)"key == (UWord)barrier",   8237       vgPlain_assert_fail((Bool )0, (Char const   *)"key == (UWord)barrier",
8238                           (Char const   *)"hg_main.c", 2683,   8238                           (Char const   *)"hg_main.c", 2683,
8239                           (Char const   *)"map_barrier_to_Bar_lookup_or_alloc",   8239                           (Char const   *)"map_barrier_to_Bar_lookup_or_alloc",
8240                           "");   8240                           "");
8241     }   8241     }
8242     return ((Bar *)val);   8242     return ((Bar *)val);
8243   } else {   8243   } else {
8244     tmp = new_Bar();   8244     tmp = new_Bar();
8245     bar = tmp;   8245     bar = tmp;
8246     vgPlain_addToFM(map_barrier_to_Bar, (UWord )barrier, (UWord )bar);   8246     vgPlain_addToFM(map_barrier_to_Bar, (UWord )barrier, (UWord )bar);
8247     return (bar);   8247     return (bar);
8248   }   8248   }
8249 }   8249 }
8250 }   8250 }
8251 static void map_barrier_to_Bar_delete(void *barrier )   8251 static void map_barrier_to_Bar_delete(void *barrier )
8252 {   8252 {
8253   UWord keyW ;   8253   UWord keyW ;
8254   UWord valW ;   8254   UWord valW ;
8255   Bar *bar ;   8255   Bar *bar ;
8256   Bool tmp ;   8256   Bool tmp ;
8257     8257  
8258   {   8258   {
8259   map_barrier_to_Bar_INIT();   8259   map_barrier_to_Bar_INIT();
8260   tmp = vgPlain_delFromFM(map_barrier_to_Bar, & keyW, & valW, (UWord )barrier);   8260   tmp = vgPlain_delFromFM(map_barrier_to_Bar, & keyW, & valW, (UWord )barrier);
8261   if (tmp) {   8261   if (tmp) {
8262     bar = (Bar *)valW;   8262     bar = (Bar *)valW;
8263     if (keyW == (UWord )barrier) {   8263     if (keyW == (UWord )barrier) {
8264     8264  
8265     } else {   8265     } else {
8266       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (UWord)barrier",   8266       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (UWord)barrier",
8267                           (Char const   *)"hg_main.c", 2697,   8267                           (Char const   *)"hg_main.c", 2697,
8268                           (Char const   *)"map_barrier_to_Bar_delete", "");   8268                           (Char const   *)"map_barrier_to_Bar_delete", "");
8269     }   8269     }
8270     delete_Bar(bar);   8270     delete_Bar(bar);
8271   } else {   8271   } else {
8272     8272  
8273   }   8273   }
8274   return;   8274   return;
8275 }   8275 }
8276 }   8276 }
8277 static void evh__HG_PTHREAD_BARRIER_INIT_PRE(ThreadId tid , void *barrier ,   8277 static void evh__HG_PTHREAD_BARRIER_INIT_PRE(ThreadId tid , void *barrier ,
8278                                              UWord count , UWord resizable )   8278                                              UWord count , UWord resizable )
8279 {   8279 {
8280   Thread *thr ;   8280   Thread *thr ;
8281   Bar *bar ;   8281   Bar *bar ;
8282   Word tmp ;   8282   Word tmp ;
8283   Word tmp___0 ;   8283   Word tmp___0 ;
8284   Word tmp___1 ;   8284   Word tmp___1 ;
8285     8285  
8286   {   8286   {
8287   thr = map_threads_maybe_lookup(tid);   8287   thr = map_threads_maybe_lookup(tid);
8288   if (thr) {   8288   if (thr) {
8289     8289  
8290   } else {   8290   } else {
8291     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   8291     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
8292                         (Char const   *)"hg_main.c", 2717,   8292                         (Char const   *)"hg_main.c", 2717,
8293                         (Char const   *)"evh__HG_PTHREAD_BARRIER_INIT_PRE", "");   8293                         (Char const   *)"evh__HG_PTHREAD_BARRIER_INIT_PRE", "");
8294   }   8294   }
8295   if (count == 0UL) {   8295   if (count == 0UL) {
8296     vgHelgrind_record_error_Misc(thr,   8296     vgHelgrind_record_error_Misc(thr,
8297                                  (HChar *)"pthread_barrier_init: \'count\' argument is zero");   8297                                  (HChar *)"pthread_barrier_init: \'count\' argument is zero");
8298   } else {   8298   } else {
8299     8299  
8300   }   8300   }
8301   if (resizable != 0UL) {   8301   if (resizable != 0UL) {
8302     if (resizable != 1UL) {   8302     if (resizable != 1UL) {
8303       vgHelgrind_record_error_Misc(thr,   8303       vgHelgrind_record_error_Misc(thr,
8304                                    (HChar *)"pthread_barrier_init: invalid \'resizable\' argument");   8304                                    (HChar *)"pthread_barrier_init: invalid \'resizable\' argument");
8305     } else {   8305     } else {
8306     8306  
8307     }   8307     }
8308   } else {   8308   } else {
8309     8309  
8310   }   8310   }
8311   bar = map_barrier_to_Bar_lookup_or_alloc(barrier);   8311   bar = map_barrier_to_Bar_lookup_or_alloc(barrier);
8312   if (bar) {   8312   if (bar) {
8313     8313  
8314   } else {   8314   } else {
8315     vgPlain_assert_fail((Bool )0, (Char const   *)"bar",   8315     vgPlain_assert_fail((Bool )0, (Char const   *)"bar",
8316                         (Char const   *)"hg_main.c", 2732,   8316                         (Char const   *)"hg_main.c", 2732,
8317                         (Char const   *)"evh__HG_PTHREAD_BARRIER_INIT_PRE", "");   8317                         (Char const   *)"evh__HG_PTHREAD_BARRIER_INIT_PRE", "");
8318   }   8318   }
8319   if (bar->initted) {   8319   if (bar->initted) {
8320     vgHelgrind_record_error_Misc(thr,   8320     vgHelgrind_record_error_Misc(thr,
8321                                  (HChar *)"pthread_barrier_init: barrier is already initialised");   8321                                  (HChar *)"pthread_barrier_init: barrier is already initialised");
8322   } else {   8322   } else {
8323     8323  
8324   }   8324   }
8325   if (bar->waiting) {   8325   if (bar->waiting) {
8326     tmp___0 = vgPlain_sizeXA(bar->waiting);   8326     tmp___0 = vgPlain_sizeXA(bar->waiting);
8327     if (tmp___0 > 0L) {   8327     if (tmp___0 > 0L) {
8328       if (bar->initted) {   8328       if (bar->initted) {
8329     8329  
8330       } else {   8330       } else {
8331         vgPlain_assert_fail((Bool )0, (Char const   *)"bar->initted",   8331         vgPlain_assert_fail((Bool )0, (Char const   *)"bar->initted",
8332                             (Char const   *)"hg_main.c", 2741,   8332                             (Char const   *)"hg_main.c", 2741,
8333                             (Char const   *)"evh__HG_PTHREAD_BARRIER_INIT_PRE",   8333                             (Char const   *)"evh__HG_PTHREAD_BARRIER_INIT_PRE",
8334                             "");   8334                             "");
8335       }   8335       }
8336       vgHelgrind_record_error_Misc(thr,   8336       vgHelgrind_record_error_Misc(thr,
8337                                    (HChar *)"pthread_barrier_init: threads are waiting at barrier");   8337                                    (HChar *)"pthread_barrier_init: threads are waiting at barrier");
8338       tmp = vgPlain_sizeXA(bar->waiting);   8338       tmp = vgPlain_sizeXA(bar->waiting);
8339       vgPlain_dropTailXA(bar->waiting, tmp);   8339       vgPlain_dropTailXA(bar->waiting, tmp);
8340     } else {   8340     } else {
8341     8341  
8342     }   8342     }
8343   } else {   8343   } else {
8344     8344  
8345   }   8345   }
8346   if (! bar->waiting) {   8346   if (! bar->waiting) {
8347     bar->waiting = vgPlain_newXA(& vgHelgrind_zalloc, (HChar *)"hg.eHPBIP.1",   8347     bar->waiting = vgPlain_newXA(& vgHelgrind_zalloc, (HChar *)"hg.eHPBIP.1",
8348                                  & vgHelgrind_free, (Word )sizeof(Thread *));   8348                                  & vgHelgrind_free, (Word )sizeof(Thread *));
8349   } else {   8349   } else {
8350     8350  
8351   }   8351   }
8352   if (bar->waiting) {   8352   if (bar->waiting) {
8353     8353  
8354   } else {   8354   } else {
8355     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->waiting",   8355     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->waiting",
8356                         (Char const   *)"hg_main.c", 2752,   8356                         (Char const   *)"hg_main.c", 2752,
8357                         (Char const   *)"evh__HG_PTHREAD_BARRIER_INIT_PRE", "");   8357                         (Char const   *)"evh__HG_PTHREAD_BARRIER_INIT_PRE", "");
8358   }   8358   }
8359   tmp___1 = vgPlain_sizeXA(bar->waiting);   8359   tmp___1 = vgPlain_sizeXA(bar->waiting);
8360   if (tmp___1 == 0L) {   8360   if (tmp___1 == 0L) {
8361     8361  
8362   } else {   8362   } else {
8363     vgPlain_assert_fail((Bool )0,   8363     vgPlain_assert_fail((Bool )0,
8364                         (Char const   *)"VG_(sizeXA)(bar->waiting) == 0",   8364                         (Char const   *)"VG_(sizeXA)(bar->waiting) == 0",
8365                         (Char const   *)"hg_main.c", 2753,   8365                         (Char const   *)"hg_main.c", 2753,
8366                         (Char const   *)"evh__HG_PTHREAD_BARRIER_INIT_PRE", "");   8366                         (Char const   *)"evh__HG_PTHREAD_BARRIER_INIT_PRE", "");
8367   }   8367   }
8368   bar->initted = (Bool )1;   8368   bar->initted = (Bool )1;
8369   if (resizable == 1UL) {   8369   if (resizable == 1UL) {
8370     bar->resizable = (Bool )1;   8370     bar->resizable = (Bool )1;
8371   } else {   8371   } else {
8372     bar->resizable = (Bool )0;   8372     bar->resizable = (Bool )0;
8373   }   8373   }
8374   bar->size = count;   8374   bar->size = count;
8375   return;   8375   return;
8376 }   8376 }
8377 }   8377 }
8378 static void evh__HG_PTHREAD_BARRIER_DESTROY_PRE(ThreadId tid , void *barrier )   8378 static void evh__HG_PTHREAD_BARRIER_DESTROY_PRE(ThreadId tid , void *barrier )
8379 {   8379 {
8380   Thread *thr ;   8380   Thread *thr ;
8381   Bar *bar ;   8381   Bar *bar ;
8382   Word tmp ;   8382   Word tmp ;
8383     8383  
8384   {   8384   {
8385   thr = map_threads_maybe_lookup(tid);   8385   thr = map_threads_maybe_lookup(tid);
8386   if (thr) {   8386   if (thr) {
8387     8387  
8388   } else {   8388   } else {
8389     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   8389     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
8390                         (Char const   *)"hg_main.c", 2775,   8390                         (Char const   *)"hg_main.c", 2775,
8391                         (Char const   *)"evh__HG_PTHREAD_BARRIER_DESTROY_PRE",   8391                         (Char const   *)"evh__HG_PTHREAD_BARRIER_DESTROY_PRE",
8392                         "");   8392                         "");
8393   }   8393   }
8394   bar = map_barrier_to_Bar_lookup_or_alloc(barrier);   8394   bar = map_barrier_to_Bar_lookup_or_alloc(barrier);
8395   if (bar) {   8395   if (bar) {
8396     8396  
8397   } else {   8397   } else {
8398     vgPlain_assert_fail((Bool )0, (Char const   *)"bar",   8398     vgPlain_assert_fail((Bool )0, (Char const   *)"bar",
8399                         (Char const   *)"hg_main.c", 2778,   8399                         (Char const   *)"hg_main.c", 2778,
8400                         (Char const   *)"evh__HG_PTHREAD_BARRIER_DESTROY_PRE",   8400                         (Char const   *)"evh__HG_PTHREAD_BARRIER_DESTROY_PRE",
8401                         "");   8401                         "");
8402   }   8402   }
8403   if (! bar->initted) {   8403   if (! bar->initted) {
8404     vgHelgrind_record_error_Misc(thr,   8404     vgHelgrind_record_error_Misc(thr,
8405                                  (HChar *)"pthread_barrier_destroy: barrier was never initialised");   8405                                  (HChar *)"pthread_barrier_destroy: barrier was never initialised");
8406   } else {   8406   } else {
8407     8407  
8408   }   8408   }
8409   if (bar->initted) {   8409   if (bar->initted) {
8410     if (bar->waiting) {   8410     if (bar->waiting) {
8411       tmp = vgPlain_sizeXA(bar->waiting);   8411       tmp = vgPlain_sizeXA(bar->waiting);
8412       if (tmp > 0L) {   8412       if (tmp > 0L) {
8413         vgHelgrind_record_error_Misc(thr,   8413         vgHelgrind_record_error_Misc(thr,
8414                                      (HChar *)"pthread_barrier_destroy: threads are waiting at barrier");   8414                                      (HChar *)"pthread_barrier_destroy: threads are waiting at barrier");
8415       } else {   8415       } else {
8416     8416  
8417       }   8417       }
8418     } else {   8418     } else {
8419     8419  
8420     }   8420     }
8421   } else {   8421   } else {
8422     8422  
8423   }   8423   }
8424   map_barrier_to_Bar_delete(barrier);   8424   map_barrier_to_Bar_delete(barrier);
8425   return;   8425   return;
8426 }   8426 }
8427 }   8427 }
8428 static void do_barrier_cross_sync_and_empty(Bar *bar )   8428 static void do_barrier_cross_sync_and_empty(Bar *bar )
8429 {   8429 {
8430   UWord i ;   8430   UWord i ;
8431   SO *so ;   8431   SO *so ;
8432   SO *tmp ;   8432   SO *tmp ;
8433   Word tmp___0 ;   8433   Word tmp___0 ;
8434   Thread *t ;   8434   Thread *t ;
8435   void *tmp___1 ;   8435   void *tmp___1 ;
8436   Thr *hbthr ;   8436   Thr *hbthr ;
8437   Thread *t___0 ;   8437   Thread *t___0 ;
8438   void *tmp___2 ;   8438   void *tmp___2 ;
8439   Thr *hbthr___0 ;   8439   Thr *hbthr___0 ;
8440   Word tmp___3 ;   8440   Word tmp___3 ;
8441     8441  
8442   {   8442   {
8443   tmp = libhb_so_alloc();   8443   tmp = libhb_so_alloc();
8444   so = tmp;   8444   so = tmp;
8445   if (bar->waiting) {   8445   if (bar->waiting) {
8446     8446  
8447   } else {   8447   } else {
8448     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->waiting",   8448     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->waiting",
8449                         (Char const   *)"hg_main.c", 2816,   8449                         (Char const   *)"hg_main.c", 2816,
8450                         (Char const   *)"do_barrier_cross_sync_and_empty", "");   8450                         (Char const   *)"do_barrier_cross_sync_and_empty", "");
8451   }   8451   }
8452   tmp___0 = vgPlain_sizeXA(bar->waiting);   8452   tmp___0 = vgPlain_sizeXA(bar->waiting);
8453   if ((UWord )tmp___0 == bar->size) {   8453   if ((UWord )tmp___0 == bar->size) {
8454     8454  
8455   } else {   8455   } else {
8456     vgPlain_assert_fail((Bool )0,   8456     vgPlain_assert_fail((Bool )0,
8457                         (Char const   *)"VG_(sizeXA)(bar->waiting) == bar->size",   8457                         (Char const   *)"VG_(sizeXA)(bar->waiting) == bar->size",
8458                         (Char const   *)"hg_main.c", 2817,   8458                         (Char const   *)"hg_main.c", 2817,
8459                         (Char const   *)"do_barrier_cross_sync_and_empty", "");   8459                         (Char const   *)"do_barrier_cross_sync_and_empty", "");
8460   }   8460   }
8461   i = (UWord )0;   8461   i = (UWord )0;
8462   while (i < bar->size) {   8462   while (i < bar->size) {
8463     tmp___1 = vgPlain_indexXA(bar->waiting, (Word )i);   8463     tmp___1 = vgPlain_indexXA(bar->waiting, (Word )i);
8464     t = *((Thread **)tmp___1);   8464     t = *((Thread **)tmp___1);
8465     hbthr = t->hbthr;   8465     hbthr = t->hbthr;
8466     libhb_so_send(hbthr, so, (Bool )0);   8466     libhb_so_send(hbthr, so, (Bool )0);
8467     i ++;   8467     i ++;
8468   }   8468   }
8469   i = (UWord )0;   8469   i = (UWord )0;
8470   while (i < bar->size) {   8470   while (i < bar->size) {
8471     tmp___2 = vgPlain_indexXA(bar->waiting, (Word )i);   8471     tmp___2 = vgPlain_indexXA(bar->waiting, (Word )i);
8472     t___0 = *((Thread **)tmp___2);   8472     t___0 = *((Thread **)tmp___2);
8473     hbthr___0 = t___0->hbthr;   8473     hbthr___0 = t___0->hbthr;
8474     libhb_so_recv(hbthr___0, so, (Bool )1);   8474     libhb_so_recv(hbthr___0, so, (Bool )1);
8475     i ++;   8475     i ++;
8476   }   8476   }
8477   tmp___3 = vgPlain_sizeXA(bar->waiting);   8477   tmp___3 = vgPlain_sizeXA(bar->waiting);
8478   vgPlain_dropTailXA(bar->waiting, tmp___3);   8478   vgPlain_dropTailXA(bar->waiting, tmp___3);
8479   libhb_so_dealloc(so);   8479   libhb_so_dealloc(so);
8480   return;   8480   return;
8481 }   8481 }
8482 }   8482 }
8483 static void evh__HG_PTHREAD_BARRIER_WAIT_PRE(ThreadId tid , void *barrier )   8483 static void evh__HG_PTHREAD_BARRIER_WAIT_PRE(ThreadId tid , void *barrier )
8484 {   8484 {
8485   Thread *thr ;   8485   Thread *thr ;
8486   Bar *bar ;   8486   Bar *bar ;
8487   UWord present ;   8487   UWord present ;
8488   Word tmp ;   8488   Word tmp ;
8489     8489  
8490   {   8490   {
8491   thr = map_threads_maybe_lookup(tid);   8491   thr = map_threads_maybe_lookup(tid);
8492   if (thr) {   8492   if (thr) {
8493     8493  
8494   } else {   8494   } else {
8495     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   8495     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
8496                         (Char const   *)"hg_main.c", 2894,   8496                         (Char const   *)"hg_main.c", 2894,
8497                         (Char const   *)"evh__HG_PTHREAD_BARRIER_WAIT_PRE", "");   8497                         (Char const   *)"evh__HG_PTHREAD_BARRIER_WAIT_PRE", "");
8498   }   8498   }
8499   bar = map_barrier_to_Bar_lookup_or_alloc(barrier);   8499   bar = map_barrier_to_Bar_lookup_or_alloc(barrier);
8500   if (bar) {   8500   if (bar) {
8501     8501  
8502   } else {   8502   } else {
8503     vgPlain_assert_fail((Bool )0, (Char const   *)"bar",   8503     vgPlain_assert_fail((Bool )0, (Char const   *)"bar",
8504                         (Char const   *)"hg_main.c", 2897,   8504                         (Char const   *)"hg_main.c", 2897,
8505                         (Char const   *)"evh__HG_PTHREAD_BARRIER_WAIT_PRE", "");   8505                         (Char const   *)"evh__HG_PTHREAD_BARRIER_WAIT_PRE", "");
8506   }   8506   }
8507   if (! bar->initted) {   8507   if (! bar->initted) {
8508     vgHelgrind_record_error_Misc(thr,   8508     vgHelgrind_record_error_Misc(thr,
8509                                  (HChar *)"pthread_barrier_wait: barrier is uninitialised");   8509                                  (HChar *)"pthread_barrier_wait: barrier is uninitialised");
8510     return;   8510     return;
8511   } else {   8511   } else {
8512     8512  
8513   }   8513   }
8514   if (bar->size > 0UL) {   8514   if (bar->size > 0UL) {
8515     8515  
8516   } else {   8516   } else {
8517     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->size > 0",   8517     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->size > 0",
8518                         (Char const   *)"hg_main.c", 2907,   8518                         (Char const   *)"hg_main.c", 2907,
8519                         (Char const   *)"evh__HG_PTHREAD_BARRIER_WAIT_PRE", "");   8519                         (Char const   *)"evh__HG_PTHREAD_BARRIER_WAIT_PRE", "");
8520   }   8520   }
8521   if (bar->waiting) {   8521   if (bar->waiting) {
8522     8522  
8523   } else {   8523   } else {
8524     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->waiting",   8524     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->waiting",
8525                         (Char const   *)"hg_main.c", 2908,   8525                         (Char const   *)"hg_main.c", 2908,
8526                         (Char const   *)"evh__HG_PTHREAD_BARRIER_WAIT_PRE", "");   8526                         (Char const   *)"evh__HG_PTHREAD_BARRIER_WAIT_PRE", "");
8527   }   8527   }
8528   vgPlain_addToXA(bar->waiting, (void *)(& thr));   8528   vgPlain_addToXA(bar->waiting, (void *)(& thr));
8529   tmp = vgPlain_sizeXA(bar->waiting);   8529   tmp = vgPlain_sizeXA(bar->waiting);
8530   present = (UWord )tmp;   8530   present = (UWord )tmp;
8531   if (present > 0UL) {   8531   if (present > 0UL) {
8532     if (present <= bar->size) {   8532     if (present <= bar->size) {
8533     8533  
8534     } else {   8534     } else {
8535       vgPlain_assert_fail((Bool )0,   8535       vgPlain_assert_fail((Bool )0,
8536                           (Char const   *)"present > 0 && present <= bar->size",   8536                           (Char const   *)"present > 0 && present <= bar->size",
8537                           (Char const   *)"hg_main.c", 2914,   8537                           (Char const   *)"hg_main.c", 2914,
8538                           (Char const   *)"evh__HG_PTHREAD_BARRIER_WAIT_PRE", "");   8538                           (Char const   *)"evh__HG_PTHREAD_BARRIER_WAIT_PRE", "");
8539     }   8539     }
8540   } else {   8540   } else {
8541     vgPlain_assert_fail((Bool )0,   8541     vgPlain_assert_fail((Bool )0,
8542                         (Char const   *)"present > 0 && present <= bar->size",   8542                         (Char const   *)"present > 0 && present <= bar->size",
8543                         (Char const   *)"hg_main.c", 2914,   8543                         (Char const   *)"hg_main.c", 2914,
8544                         (Char const   *)"evh__HG_PTHREAD_BARRIER_WAIT_PRE", "");   8544                         (Char const   *)"evh__HG_PTHREAD_BARRIER_WAIT_PRE", "");
8545   }   8545   }
8546   if (present < bar->size) {   8546   if (present < bar->size) {
8547     return;   8547     return;
8548   } else {   8548   } else {
8549     8549  
8550   }   8550   }
8551   do_barrier_cross_sync_and_empty(bar);   8551   do_barrier_cross_sync_and_empty(bar);
8552   return;   8552   return;
8553 }   8553 }
8554 }   8554 }
8555 static void evh__HG_PTHREAD_BARRIER_RESIZE_PRE(ThreadId tid , void *barrier ,   8555 static void evh__HG_PTHREAD_BARRIER_RESIZE_PRE(ThreadId tid , void *barrier ,
8556                                                UWord newcount )   8556                                                UWord newcount )
8557 {   8557 {
8558   Thread *thr ;   8558   Thread *thr ;
8559   Bar *bar ;   8559   Bar *bar ;
8560   UWord present ;   8560   UWord present ;
8561   Word tmp ;   8561   Word tmp ;
8562     8562  
8563   {   8563   {
8564   thr = map_threads_maybe_lookup(tid);   8564   thr = map_threads_maybe_lookup(tid);
8565   if (thr) {   8565   if (thr) {
8566     8566  
8567   } else {   8567   } else {
8568     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   8568     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
8569                         (Char const   *)"hg_main.c", 2937,   8569                         (Char const   *)"hg_main.c", 2937,
8570                         (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE", "");   8570                         (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE", "");
8571   }   8571   }
8572   bar = map_barrier_to_Bar_lookup_or_alloc(barrier);   8572   bar = map_barrier_to_Bar_lookup_or_alloc(barrier);
8573   if (bar) {   8573   if (bar) {
8574     8574  
8575   } else {   8575   } else {
8576     vgPlain_assert_fail((Bool )0, (Char const   *)"bar",   8576     vgPlain_assert_fail((Bool )0, (Char const   *)"bar",
8577                         (Char const   *)"hg_main.c", 2940,   8577                         (Char const   *)"hg_main.c", 2940,
8578                         (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE", "");   8578                         (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE", "");
8579   }   8579   }
8580   if (! bar->initted) {   8580   if (! bar->initted) {
8581     vgHelgrind_record_error_Misc(thr,   8581     vgHelgrind_record_error_Misc(thr,
8582                                  (HChar *)"pthread_barrier_resize: barrier is uninitialised");   8582                                  (HChar *)"pthread_barrier_resize: barrier is uninitialised");
8583     return;   8583     return;
8584   } else {   8584   } else {
8585     8585  
8586   }   8586   }
8587   if (! bar->resizable) {   8587   if (! bar->resizable) {
8588     vgHelgrind_record_error_Misc(thr,   8588     vgHelgrind_record_error_Misc(thr,
8589                                  (HChar *)"pthread_barrier_resize: barrier is may not be resized");   8589                                  (HChar *)"pthread_barrier_resize: barrier is may not be resized");
8590     return;   8590     return;
8591   } else {   8591   } else {
8592     8592  
8593   }   8593   }
8594   if (newcount == 0UL) {   8594   if (newcount == 0UL) {
8595     vgHelgrind_record_error_Misc(thr,   8595     vgHelgrind_record_error_Misc(thr,
8596                                  (HChar *)"pthread_barrier_resize: \'newcount\' argument is zero");   8596                                  (HChar *)"pthread_barrier_resize: \'newcount\' argument is zero");
8597     return;   8597     return;
8598   } else {   8598   } else {
8599     8599  
8600   }   8600   }
8601   if (bar->size > 0UL) {   8601   if (bar->size > 0UL) {
8602     8602  
8603   } else {   8603   } else {
8604     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->size > 0",   8604     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->size > 0",
8605                         (Char const   *)"hg_main.c", 2964,   8605                         (Char const   *)"hg_main.c", 2964,
8606                         (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE", "");   8606                         (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE", "");
8607   }   8607   }
8608   if (bar->waiting) {   8608   if (bar->waiting) {
8609     8609  
8610   } else {   8610   } else {
8611     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->waiting",   8611     vgPlain_assert_fail((Bool )0, (Char const   *)"bar->waiting",
8612                         (Char const   *)"hg_main.c", 2965,   8612                         (Char const   *)"hg_main.c", 2965,
8613                         (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE", "");   8613                         (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE", "");
8614   }   8614   }
8615   if (newcount > 0UL) {   8615   if (newcount > 0UL) {
8616     8616  
8617   } else {   8617   } else {
8618     vgPlain_assert_fail((Bool )0, (Char const   *)"newcount > 0",   8618     vgPlain_assert_fail((Bool )0, (Char const   *)"newcount > 0",
8619                         (Char const   *)"hg_main.c", 2967,   8619                         (Char const   *)"hg_main.c", 2967,
8620                         (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE", "");   8620                         (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE", "");
8621   }   8621   }
8622   if (newcount >= bar->size) {   8622   if (newcount >= bar->size) {
8623     bar->size = newcount;   8623     bar->size = newcount;
8624   } else {   8624   } else {
8625     tmp = vgPlain_sizeXA(bar->waiting);   8625     tmp = vgPlain_sizeXA(bar->waiting);
8626     present = (UWord )tmp;   8626     present = (UWord )tmp;
8627     if (present >= 0UL) {   8627     if (present >= 0UL) {
8628       if (present <= bar->size) {   8628       if (present <= bar->size) {
8629     8629  
8630       } else {   8630       } else {
8631         vgPlain_assert_fail((Bool )0,   8631         vgPlain_assert_fail((Bool )0,
8632                             (Char const   *)"present >= 0 && present <= bar->size",   8632                             (Char const   *)"present >= 0 && present <= bar->size",
8633                             (Char const   *)"hg_main.c", 2980,   8633                             (Char const   *)"hg_main.c", 2980,
8634                             (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE",   8634                             (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE",
8635                             "");   8635                             "");
8636       }   8636       }
8637     } else {   8637     } else {
8638       vgPlain_assert_fail((Bool )0,   8638       vgPlain_assert_fail((Bool )0,
8639                           (Char const   *)"present >= 0 && present <= bar->size",   8639                           (Char const   *)"present >= 0 && present <= bar->size",
8640                           (Char const   *)"hg_main.c", 2980,   8640                           (Char const   *)"hg_main.c", 2980,
8641                           (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE",   8641                           (Char const   *)"evh__HG_PTHREAD_BARRIER_RESIZE_PRE",
8642                           "");   8642                           "");
8643     }   8643     }
8644     if (newcount <= present) {   8644     if (newcount <= present) {
8645       bar->size = present;   8645       bar->size = present;
8646       do_barrier_cross_sync_and_empty(bar);   8646       do_barrier_cross_sync_and_empty(bar);
8647     } else {   8647     } else {
8648     8648  
8649     }   8649     }
8650     bar->size = newcount;   8650     bar->size = newcount;
8651   }   8651   }
8652   return;   8652   return;
8653 }   8653 }
8654 }   8654 }
8655 static WordFM *map_usertag_to_SO  =    (WordFM *)((void *)0);   8655 static WordFM *map_usertag_to_SO  =    (WordFM *)((void *)0);
8656 static void map_usertag_to_SO_INIT(void)   8656 static void map_usertag_to_SO_INIT(void)
8657 {   8657 {
8658   long tmp ;   8658   long tmp ;
8659     8659  
8660   {   8660   {
8661   tmp = __builtin_expect((long )((unsigned int )map_usertag_to_SO == (unsigned int )((void *)0)),   8661   tmp = __builtin_expect((long )((unsigned int )map_usertag_to_SO == (unsigned int )((void *)0)),
8662                          0L);   8662                          0L);
8663   if (tmp) {   8663   if (tmp) {
8664     map_usertag_to_SO = vgPlain_newFM(& vgHelgrind_zalloc, (HChar *)"hg.mutS.1",   8664     map_usertag_to_SO = vgPlain_newFM(& vgHelgrind_zalloc, (HChar *)"hg.mutS.1",
8665                                       & vgHelgrind_free,   8665                                       & vgHelgrind_free,
8666                                       (Word (*)(UWord  , UWord  ))((void *)0));   8666                                       (Word (*)(UWord  , UWord  ))((void *)0));
8667     if ((unsigned int )map_usertag_to_SO != (unsigned int )((void *)0)) {   8667     if ((unsigned int )map_usertag_to_SO != (unsigned int )((void *)0)) {
8668     8668  
8669     } else {   8669     } else {
8670       vgPlain_assert_fail((Bool )0, (Char const   *)"map_usertag_to_SO != NULL",   8670       vgPlain_assert_fail((Bool )0, (Char const   *)"map_usertag_to_SO != NULL",
8671                           (Char const   *)"hg_main.c", 3007,   8671                           (Char const   *)"hg_main.c", 3007,
8672                           (Char const   *)"map_usertag_to_SO_INIT", "");   8672                           (Char const   *)"map_usertag_to_SO_INIT", "");
8673     }   8673     }
8674   } else {   8674   } else {
8675     8675  
8676   }   8676   }
8677   return;   8677   return;
8678 }   8678 }
8679 }   8679 }
8680 static SO *map_usertag_to_SO_lookup_or_alloc(UWord usertag )   8680 static SO *map_usertag_to_SO_lookup_or_alloc(UWord usertag )
8681 {   8681 {
8682   UWord key ;   8682   UWord key ;
8683   UWord val ;   8683   UWord val ;
8684   SO *so ;   8684   SO *so ;
8685   SO *tmp ;   8685   SO *tmp ;
8686   Bool tmp___0 ;   8686   Bool tmp___0 ;
8687     8687  
8688   {   8688   {
8689   map_usertag_to_SO_INIT();   8689   map_usertag_to_SO_INIT();
8690   tmp___0 = vgPlain_lookupFM(map_usertag_to_SO, & key, & val, usertag);   8690   tmp___0 = vgPlain_lookupFM(map_usertag_to_SO, & key, & val, usertag);
8691   if (tmp___0) {   8691   if (tmp___0) {
8692     if (key == usertag) {   8692     if (key == usertag) {
8693     8693  
8694     } else {   8694     } else {
8695       vgPlain_assert_fail((Bool )0, (Char const   *)"key == (UWord)usertag",   8695       vgPlain_assert_fail((Bool )0, (Char const   *)"key == (UWord)usertag",
8696                           (Char const   *)"hg_main.c", 3015,   8696                           (Char const   *)"hg_main.c", 3015,
8697                           (Char const   *)"map_usertag_to_SO_lookup_or_alloc",   8697                           (Char const   *)"map_usertag_to_SO_lookup_or_alloc",
8698                           "");   8698                           "");
8699     }   8699     }
8700     return ((SO *)val);   8700     return ((SO *)val);
8701   } else {   8701   } else {
8702     tmp = libhb_so_alloc();   8702     tmp = libhb_so_alloc();
8703     so = tmp;   8703     so = tmp;
8704     vgPlain_addToFM(map_usertag_to_SO, usertag, (UWord )so);   8704     vgPlain_addToFM(map_usertag_to_SO, usertag, (UWord )so);
8705     return (so);   8705     return (so);
8706   }   8706   }
8707 }   8707 }
8708 }   8708 }
8709 static void map_usertag_to_SO_delete(UWord usertag )   8709 static void map_usertag_to_SO_delete(UWord usertag )
8710 {   8710 {
8711   UWord keyW ;   8711   UWord keyW ;
8712   UWord valW ;   8712   UWord valW ;
8713   SO *so ;   8713   SO *so ;
8714   Bool tmp ;   8714   Bool tmp ;
8715     8715  
8716   {   8716   {
8717   map_usertag_to_SO_INIT();   8717   map_usertag_to_SO_INIT();
8718   tmp = vgPlain_delFromFM(map_usertag_to_SO, & keyW, & valW, usertag);   8718   tmp = vgPlain_delFromFM(map_usertag_to_SO, & keyW, & valW, usertag);
8719   if (tmp) {   8719   if (tmp) {
8720     so = (SO *)valW;   8720     so = (SO *)valW;
8721     if (keyW == usertag) {   8721     if (keyW == usertag) {
8722     8722  
8723     } else {   8723     } else {
8724       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == usertag",   8724       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == usertag",
8725                           (Char const   *)"hg_main.c", 3029,   8725                           (Char const   *)"hg_main.c", 3029,
8726                           (Char const   *)"map_usertag_to_SO_delete", "");   8726                           (Char const   *)"map_usertag_to_SO_delete", "");
8727     }   8727     }
8728     if (so) {   8728     if (so) {
8729     8729  
8730     } else {   8730     } else {
8731       vgPlain_assert_fail((Bool )0, (Char const   *)"so",   8731       vgPlain_assert_fail((Bool )0, (Char const   *)"so",
8732                           (Char const   *)"hg_main.c", 3030,   8732                           (Char const   *)"hg_main.c", 3030,
8733                           (Char const   *)"map_usertag_to_SO_delete", "");   8733                           (Char const   *)"map_usertag_to_SO_delete", "");
8734     }   8734     }
8735     libhb_so_dealloc(so);   8735     libhb_so_dealloc(so);
8736   } else {   8736   } else {
8737     8737  
8738   }   8738   }
8739   return;   8739   return;
8740 }   8740 }
8741 }   8741 }
8742 static void evh__HG_USERSO_SEND_PRE(ThreadId tid , UWord usertag )   8742 static void evh__HG_USERSO_SEND_PRE(ThreadId tid , UWord usertag )
8743 {   8743 {
8744   Thread *thr ;   8744   Thread *thr ;
8745   SO *so ;   8745   SO *so ;
8746     8746  
8747   {   8747   {
8748   thr = map_threads_maybe_lookup(tid);   8748   thr = map_threads_maybe_lookup(tid);
8749   if (thr) {   8749   if (thr) {
8750     8750  
8751   } else {   8751   } else {
8752     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   8752     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
8753                         (Char const   *)"hg_main.c", 3056,   8753                         (Char const   *)"hg_main.c", 3056,
8754                         (Char const   *)"evh__HG_USERSO_SEND_PRE", "");   8754                         (Char const   *)"evh__HG_USERSO_SEND_PRE", "");
8755   }   8755   }
8756   so = map_usertag_to_SO_lookup_or_alloc(usertag);   8756   so = map_usertag_to_SO_lookup_or_alloc(usertag);
8757   if (so) {   8757   if (so) {
8758     8758  
8759   } else {   8759   } else {
8760     vgPlain_assert_fail((Bool )0, (Char const   *)"so",   8760     vgPlain_assert_fail((Bool )0, (Char const   *)"so",
8761                         (Char const   *)"hg_main.c", 3059,   8761                         (Char const   *)"hg_main.c", 3059,
8762                         (Char const   *)"evh__HG_USERSO_SEND_PRE", "");   8762                         (Char const   *)"evh__HG_USERSO_SEND_PRE", "");
8763   }   8763   }
8764   libhb_so_send(thr->hbthr, so, (Bool )0);   8764   libhb_so_send(thr->hbthr, so, (Bool )0);
8765   return;   8765   return;
8766 }   8766 }
8767 }   8767 }
8768 static void evh__HG_USERSO_RECV_POST(ThreadId tid , UWord usertag )   8768 static void evh__HG_USERSO_RECV_POST(ThreadId tid , UWord usertag )
8769 {   8769 {
8770   Thread *thr ;   8770   Thread *thr ;
8771   SO *so ;   8771   SO *so ;
8772     8772  
8773   {   8773   {
8774   thr = map_threads_maybe_lookup(tid);   8774   thr = map_threads_maybe_lookup(tid);
8775   if (thr) {   8775   if (thr) {
8776     8776  
8777   } else {   8777   } else {
8778     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   8778     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
8779                         (Char const   *)"hg_main.c", 3081,   8779                         (Char const   *)"hg_main.c", 3081,
8780                         (Char const   *)"evh__HG_USERSO_RECV_POST", "");   8780                         (Char const   *)"evh__HG_USERSO_RECV_POST", "");
8781   }   8781   }
8782   so = map_usertag_to_SO_lookup_or_alloc(usertag);   8782   so = map_usertag_to_SO_lookup_or_alloc(usertag);
8783   if (so) {   8783   if (so) {
8784     8784  
8785   } else {   8785   } else {
8786     vgPlain_assert_fail((Bool )0, (Char const   *)"so",   8786     vgPlain_assert_fail((Bool )0, (Char const   *)"so",
8787                         (Char const   *)"hg_main.c", 3084,   8787                         (Char const   *)"hg_main.c", 3084,
8788                         (Char const   *)"evh__HG_USERSO_RECV_POST", "");   8788                         (Char const   *)"evh__HG_USERSO_RECV_POST", "");
8789   }   8789   }
8790   libhb_so_recv(thr->hbthr, so, (Bool )1);   8790   libhb_so_recv(thr->hbthr, so, (Bool )1);
8791   return;   8791   return;
8792 }   8792 }
8793 }   8793 }
8794 static void evh__HG_USERSO_FORGET_ALL(ThreadId tid , UWord usertag )   8794 static void evh__HG_USERSO_FORGET_ALL(ThreadId tid , UWord usertag )
8795 {   8795 {
8796     8796  
8797     8797  
8798   {   8798   {
8799   map_usertag_to_SO_delete(usertag);   8799   map_usertag_to_SO_delete(usertag);
8800   return;   8800   return;
8801 }   8801 }
8802 }   8802 }
8803 static WordFM *laog  =    (WordFM *)((void *)0);   8803 static WordFM *laog  =    (WordFM *)((void *)0);
8804 static Word cmp_LAOGLinkExposition(UWord llx1W , UWord llx2W )   8804 static Word cmp_LAOGLinkExposition(UWord llx1W , UWord llx2W )
8805 {   8805 {
8806   LAOGLinkExposition *llx1 ;   8806   LAOGLinkExposition *llx1 ;
8807   LAOGLinkExposition *llx2 ;   8807   LAOGLinkExposition *llx2 ;
8808     8808  
8809   {   8809   {
8810   llx1 = (LAOGLinkExposition *)llx1W;   8810   llx1 = (LAOGLinkExposition *)llx1W;
8811   llx2 = (LAOGLinkExposition *)llx2W;   8811   llx2 = (LAOGLinkExposition *)llx2W;
8812   if (llx1->src_ga < llx2->src_ga) {   8812   if (llx1->src_ga < llx2->src_ga) {
8813     return ((Word )-1);   8813     return ((Word )-1);
8814   } else {   8814   } else {
8815     8815  
8816   }   8816   }
8817   if (llx1->src_ga > llx2->src_ga) {   8817   if (llx1->src_ga > llx2->src_ga) {
8818     return ((Word )1);   8818     return ((Word )1);
8819   } else {   8819   } else {
8820     8820  
8821   }   8821   }
8822   if (llx1->dst_ga < llx2->dst_ga) {   8822   if (llx1->dst_ga < llx2->dst_ga) {
8823     return ((Word )-1);   8823     return ((Word )-1);
8824   } else {   8824   } else {
8825     8825  
8826   }   8826   }
8827   if (llx1->dst_ga > llx2->dst_ga) {   8827   if (llx1->dst_ga > llx2->dst_ga) {
8828     return ((Word )1);   8828     return ((Word )1);
8829   } else {   8829   } else {
8830     8830  
8831   }   8831   }
8832   return ((Word )0);   8832   return ((Word )0);
8833 }   8833 }
8834 }   8834 }
8835 static WordFM *laog_exposition  =    (WordFM *)((void *)0);   8835 static WordFM *laog_exposition  =    (WordFM *)((void *)0);
8836 static void ( __attribute__((__noinline__)) laog__init)(void)   8836 static void ( __attribute__((__noinline__)) laog__init)(void)
8837 {   8837 {
8838     8838  
8839     8839  
8840   {   8840   {
8841   if (! laog) {   8841   if (! laog) {
8842     8842  
8843   } else {   8843   } else {
8844     vgPlain_assert_fail((Bool )0, (Char const   *)"!laog",   8844     vgPlain_assert_fail((Bool )0, (Char const   *)"!laog",
8845                         (Char const   *)"hg_main.c", 3178,   8845                         (Char const   *)"hg_main.c", 3178,
8846                         (Char const   *)"laog__init", "");   8846                         (Char const   *)"laog__init", "");
8847   }   8847   }
8848   if (! laog_exposition) {   8848   if (! laog_exposition) {
8849     8849  
8850   } else {   8850   } else {
8851     vgPlain_assert_fail((Bool )0, (Char const   *)"!laog_exposition",   8851     vgPlain_assert_fail((Bool )0, (Char const   *)"!laog_exposition",
8852                         (Char const   *)"hg_main.c", 3179,   8852                         (Char const   *)"hg_main.c", 3179,
8853                         (Char const   *)"laog__init", "");   8853                         (Char const   *)"laog__init", "");
8854   }   8854   }
8855   if (vgHelgrind_clo_track_lockorders) {   8855   if (vgHelgrind_clo_track_lockorders) {
8856     8856  
8857   } else {   8857   } else {
8858     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(clo_track_lockorders)",   8858     vgPlain_assert_fail((Bool )0, (Char const   *)"HG_(clo_track_lockorders)",
8859                         (Char const   *)"hg_main.c", 3180,   8859                         (Char const   *)"hg_main.c", 3180,
8860                         (Char const   *)"laog__init", "");   8860                         (Char const   *)"laog__init", "");
8861   }   8861   }
8862   laog = vgPlain_newFM(& vgHelgrind_zalloc, (HChar *)"hg.laog__init.1",   8862   laog = vgPlain_newFM(& vgHelgrind_zalloc, (HChar *)"hg.laog__init.1",
8863                        & vgHelgrind_free,   8863                        & vgHelgrind_free,
8864                        (Word (*)(UWord  , UWord  ))((void *)0));   8864                        (Word (*)(UWord  , UWord  ))((void *)0));
8865   laog_exposition = vgPlain_newFM(& vgHelgrind_zalloc,   8865   laog_exposition = vgPlain_newFM(& vgHelgrind_zalloc,
8866                                   (HChar *)"hg.laog__init.2", & vgHelgrind_free,   8866                                   (HChar *)"hg.laog__init.2", & vgHelgrind_free,
8867                                   & cmp_LAOGLinkExposition);   8867                                   & cmp_LAOGLinkExposition);
8868   if (laog) {   8868   if (laog) {
8869     8869  
8870   } else {   8870   } else {
8871     vgPlain_assert_fail((Bool )0, (Char const   *)"laog",   8871     vgPlain_assert_fail((Bool )0, (Char const   *)"laog",
8872                         (Char const   *)"hg_main.c", 3187,   8872                         (Char const   *)"hg_main.c", 3187,
8873                         (Char const   *)"laog__init", "");   8873                         (Char const   *)"laog__init", "");
8874   }   8874   }
8875   if (laog_exposition) {   8875   if (laog_exposition) {
8876     8876  
8877   } else {   8877   } else {
8878     vgPlain_assert_fail((Bool )0, (Char const   *)"laog_exposition",   8878     vgPlain_assert_fail((Bool )0, (Char const   *)"laog_exposition",
8879                         (Char const   *)"hg_main.c", 3188,   8879                         (Char const   *)"hg_main.c", 3188,
8880                         (Char const   *)"laog__init", "");   8880                         (Char const   *)"laog__init", "");
8881   }   8881   }
8882   return;   8882   return;
8883 }   8883 }
8884 }   8884 }
8885 static void laog__show(Char *who )   8885 static void laog__show(Char *who )
8886 {   8886 {
8887   Word i ;   8887   Word i ;
8888   Word ws_size ;   8888   Word ws_size ;
8889   UWord *ws_words ;   8889   UWord *ws_words ;
8890   Lock *me ;   8890   Lock *me ;
8891   LAOGLinks *links ;   8891   LAOGLinks *links ;
8892   Bool tmp ;   8892   Bool tmp ;
8893     8893  
8894   {   8894   {
8895   vgPlain_printf("laog (requested by %s) {\n", who);   8895   vgPlain_printf("laog (requested by %s) {\n", who);
8896   vgPlain_initIterFM(laog);   8896   vgPlain_initIterFM(laog);
8897   me = (Lock *)((void *)0);   8897   me = (Lock *)((void *)0);
8898   links = (LAOGLinks *)((void *)0);   8898   links = (LAOGLinks *)((void *)0);
8899   while (1) {   8899   while (1) {
8900     tmp = vgPlain_nextIterFM(laog, (UWord *)((Word *)(& me)),   8900     tmp = vgPlain_nextIterFM(laog, (UWord *)((Word *)(& me)),
8901                              (UWord *)((Word *)(& links)));   8901                              (UWord *)((Word *)(& links)));
8902     if (tmp) {   8902     if (tmp) {
8903     8903  
8904     } else {   8904     } else {
8905       break;   8905       break;
8906     }   8906     }
8907     if (me) {   8907     if (me) {
8908     8908  
8909     } else {   8909     } else {
8910       vgPlain_assert_fail((Bool )0, (Char const   *)"me",   8910       vgPlain_assert_fail((Bool )0, (Char const   *)"me",
8911                           (Char const   *)"hg_main.c", 3202,   8911                           (Char const   *)"hg_main.c", 3202,
8912                           (Char const   *)"laog__show", "");   8912                           (Char const   *)"laog__show", "");
8913     }   8913     }
8914     if (links) {   8914     if (links) {
8915     8915  
8916     } else {   8916     } else {
8917       vgPlain_assert_fail((Bool )0, (Char const   *)"links",   8917       vgPlain_assert_fail((Bool )0, (Char const   *)"links",
8918                           (Char const   *)"hg_main.c", 3203,   8918                           (Char const   *)"hg_main.c", 3203,
8919                           (Char const   *)"laog__show", "");   8919                           (Char const   *)"laog__show", "");
8920     }   8920     }
8921     vgPlain_printf("   node %p:\n", me);   8921     vgPlain_printf("   node %p:\n", me);
8922     vgHelgrind_getPayloadWS(& ws_words, (UWord *)(& ws_size), univ_laog,   8922     vgHelgrind_getPayloadWS(& ws_words, (UWord *)(& ws_size), univ_laog,
8923                             links->inns);   8923                             links->inns);
8924     i = (Word )0;   8924     i = (Word )0;
8925     while (i < ws_size) {   8925     while (i < ws_size) {
8926       vgPlain_printf("      inn %#lx\n", *(ws_words + i));   8926       vgPlain_printf("      inn %#lx\n", *(ws_words + i));
8927       i ++;   8927       i ++;
8928     }   8928     }
8929     vgHelgrind_getPayloadWS(& ws_words, (UWord *)(& ws_size), univ_laog,   8929     vgHelgrind_getPayloadWS(& ws_words, (UWord *)(& ws_size), univ_laog,
8930                             links->outs);   8930                             links->outs);
8931     i = (Word )0;   8931     i = (Word )0;
8932     while (i < ws_size) {   8932     while (i < ws_size) {
8933       vgPlain_printf("      out %#lx\n", *(ws_words + i));   8933       vgPlain_printf("      out %#lx\n", *(ws_words + i));
8934       i ++;   8934       i ++;
8935     }   8935     }
8936     me = (Lock *)((void *)0);   8936     me = (Lock *)((void *)0);
8937     links = (LAOGLinks *)((void *)0);   8937     links = (LAOGLinks *)((void *)0);
8938   }   8938   }
8939   vgPlain_doneIterFM(laog);   8939   vgPlain_doneIterFM(laog);
8940   vgPlain_printf("}\n");   8940   vgPlain_printf("}\n");
8941   return;   8941   return;
8942 }   8942 }
8943 }   8943 }
8944 static void ( __attribute__((__noinline__)) laog__add_edge)(Lock *src ,   8944 static void ( __attribute__((__noinline__)) laog__add_edge)(Lock *src ,
8945                                                             Lock *dst )   8945                                                             Lock *dst )
8946 {   8946 {
8947   Word keyW ;   8947   Word keyW ;
8948   LAOGLinks *links ;   8948   LAOGLinks *links ;
8949   Bool presentF ;   8949   Bool presentF ;
8950   Bool presentR ;   8950   Bool presentR ;
8951   WordSetID outs_new ;   8951   WordSetID outs_new ;
8952   void *tmp ;   8952   void *tmp ;
8953   Bool tmp___0 ;   8953   Bool tmp___0 ;
8954   WordSetID inns_new ;   8954   WordSetID inns_new ;
8955   void *tmp___1 ;   8955   void *tmp___1 ;
8956   Bool tmp___2 ;   8956   Bool tmp___2 ;
8957   LAOGLinkExposition expo ;   8957   LAOGLinkExposition expo ;
8958   LAOGLinkExposition *expo2 ;   8958   LAOGLinkExposition *expo2 ;
8959   void *tmp___3 ;   8959   void *tmp___3 ;
8960   Bool tmp___4 ;   8960   Bool tmp___4 ;
8961     8961  
8962   {   8962   {
8963   presentR = (Bool )0;   8963   presentR = (Bool )0;
8964   presentF = presentR;   8964   presentF = presentR;
8965   keyW = (Word )0;   8965   keyW = (Word )0;
8966   links = (LAOGLinks *)((void *)0);   8966   links = (LAOGLinks *)((void *)0);
8967   tmp___0 = vgPlain_lookupFM(laog, (UWord *)(& keyW),   8967   tmp___0 = vgPlain_lookupFM(laog, (UWord *)(& keyW),
8968                              (UWord *)((Word *)(& links)), (UWord )((Word )src));   8968                              (UWord *)((Word *)(& links)), (UWord )((Word )src));
8969   if (tmp___0) {   8969   if (tmp___0) {
8970     if (links) {   8970     if (links) {
8971     8971  
8972     } else {   8972     } else {
8973       vgPlain_assert_fail((Bool )0, (Char const   *)"links",   8973       vgPlain_assert_fail((Bool )0, (Char const   *)"links",
8974                           (Char const   *)"hg_main.c", 3240,   8974                           (Char const   *)"hg_main.c", 3240,
8975                           (Char const   *)"laog__add_edge", "");   8975                           (Char const   *)"laog__add_edge", "");
8976     }   8976     }
8977     if (keyW == (Word )src) {   8977     if (keyW == (Word )src) {
8978     8978  
8979     } else {   8979     } else {
8980       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (Word)src",   8980       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (Word)src",
8981                           (Char const   *)"hg_main.c", 3241,   8981                           (Char const   *)"hg_main.c", 3241,
8982                           (Char const   *)"laog__add_edge", "");   8982                           (Char const   *)"laog__add_edge", "");
8983     }   8983     }
8984     outs_new = vgHelgrind_addToWS(univ_laog, links->outs, (UWord )((Word )dst));   8984     outs_new = vgHelgrind_addToWS(univ_laog, links->outs, (UWord )((Word )dst));
8985     presentF = (Bool )(outs_new == links->outs);   8985     presentF = (Bool )(outs_new == links->outs);
8986     links->outs = outs_new;   8986     links->outs = outs_new;
8987   } else {   8987   } else {
8988     tmp = vgHelgrind_zalloc((HChar *)"hg.lae.1", (SizeT )sizeof(LAOGLinks ));   8988     tmp = vgHelgrind_zalloc((HChar *)"hg.lae.1", (SizeT )sizeof(LAOGLinks ));
8989     links = (LAOGLinks *)tmp;   8989     links = (LAOGLinks *)tmp;
8990     links->inns = vgHelgrind_emptyWS(univ_laog);   8990     links->inns = vgHelgrind_emptyWS(univ_laog);
8991     links->outs = vgHelgrind_singletonWS(univ_laog, (UWord )((Word )dst));   8991     links->outs = vgHelgrind_singletonWS(univ_laog, (UWord )((Word )dst));
8992     vgPlain_addToFM(laog, (UWord )((Word )src), (UWord )((Word )links));   8992     vgPlain_addToFM(laog, (UWord )((Word )src), (UWord )((Word )links));
8993   }   8993   }
8994   keyW = (Word )0;   8994   keyW = (Word )0;
8995   links = (LAOGLinks *)((void *)0);   8995   links = (LAOGLinks *)((void *)0);
8996   tmp___2 = vgPlain_lookupFM(laog, (UWord *)(& keyW),   8996   tmp___2 = vgPlain_lookupFM(laog, (UWord *)(& keyW),
8997                              (UWord *)((Word *)(& links)), (UWord )((Word )dst));   8997                              (UWord *)((Word *)(& links)), (UWord )((Word )dst));
8998   if (tmp___2) {   8998   if (tmp___2) {
8999     if (links) {   8999     if (links) {
9000     9000  
9001     } else {   9001     } else {
9002       vgPlain_assert_fail((Bool )0, (Char const   *)"links",   9002       vgPlain_assert_fail((Bool )0, (Char const   *)"links",
9003                           (Char const   *)"hg_main.c", 3256,   9003                           (Char const   *)"hg_main.c", 3256,
9004                           (Char const   *)"laog__add_edge", "");   9004                           (Char const   *)"laog__add_edge", "");
9005     }   9005     }
9006     if (keyW == (Word )dst) {   9006     if (keyW == (Word )dst) {
9007     9007  
9008     } else {   9008     } else {
9009       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (Word)dst",   9009       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (Word)dst",
9010                           (Char const   *)"hg_main.c", 3257,   9010                           (Char const   *)"hg_main.c", 3257,
9011                           (Char const   *)"laog__add_edge", "");   9011                           (Char const   *)"laog__add_edge", "");
9012     }   9012     }
9013     inns_new = vgHelgrind_addToWS(univ_laog, links->inns, (UWord )((Word )src));   9013     inns_new = vgHelgrind_addToWS(univ_laog, links->inns, (UWord )((Word )src));
9014     presentR = (Bool )(inns_new == links->inns);   9014     presentR = (Bool )(inns_new == links->inns);
9015     links->inns = inns_new;   9015     links->inns = inns_new;
9016   } else {   9016   } else {
9017     tmp___1 = vgHelgrind_zalloc((HChar *)"hg.lae.2", (SizeT )sizeof(LAOGLinks ));   9017     tmp___1 = vgHelgrind_zalloc((HChar *)"hg.lae.2", (SizeT )sizeof(LAOGLinks ));
9018     links = (LAOGLinks *)tmp___1;   9018     links = (LAOGLinks *)tmp___1;
9019     links->inns = vgHelgrind_singletonWS(univ_laog, (UWord )((Word )src));   9019     links->inns = vgHelgrind_singletonWS(univ_laog, (UWord )((Word )src));
9020     links->outs = vgHelgrind_emptyWS(univ_laog);   9020     links->outs = vgHelgrind_emptyWS(univ_laog);
9021     vgPlain_addToFM(laog, (UWord )((Word )dst), (UWord )((Word )links));   9021     vgPlain_addToFM(laog, (UWord )((Word )dst), (UWord )((Word )links));
9022   }   9022   }
9023   if (presentF) {   9023   if (presentF) {
9024     if (presentR) {   9024     if (presentR) {
9025     9025  
9026     } else {   9026     } else {
9027       goto _L;   9027       goto _L;
9028     }   9028     }
9029   } else   9029   } else
9030   _L: /* CIL Label */   9030   _L: /* CIL Label */
9031   if (! presentF) {   9031   if (! presentF) {
9032     if (! presentR) {   9032     if (! presentR) {
9033     9033  
9034     } else {   9034     } else {
9035       vgPlain_assert_fail((Bool )0,   9035       vgPlain_assert_fail((Bool )0,
9036                           (Char const   *)"(presentF && presentR) || (!presentF && !presentR)",   9036                           (Char const   *)"(presentF && presentR) || (!presentF && !presentR)",
9037                           (Char const   *)"hg_main.c", 3268,   9037                           (Char const   *)"hg_main.c", 3268,
9038                           (Char const   *)"laog__add_edge", "");   9038                           (Char const   *)"laog__add_edge", "");
9039     }   9039     }
9040   } else {   9040   } else {
9041     vgPlain_assert_fail((Bool )0,   9041     vgPlain_assert_fail((Bool )0,
9042                         (Char const   *)"(presentF && presentR) || (!presentF && !presentR)",   9042                         (Char const   *)"(presentF && presentR) || (!presentF && !presentR)",
9043                         (Char const   *)"hg_main.c", 3268,   9043                         (Char const   *)"hg_main.c", 3268,
9044                         (Char const   *)"laog__add_edge", "");   9044                         (Char const   *)"laog__add_edge", "");
9045   }   9045   }
9046   if (! presentF) {   9046   if (! presentF) {
9047     if (src->acquired_at) {   9047     if (src->acquired_at) {
9048       if (dst->acquired_at) {   9048       if (dst->acquired_at) {
9049         expo.src_ga = src->guestaddr;   9049         expo.src_ga = src->guestaddr;
9050         expo.dst_ga = dst->guestaddr;   9050         expo.dst_ga = dst->guestaddr;
9051         expo.src_ec = (ExeContext *)((void *)0);   9051         expo.src_ec = (ExeContext *)((void *)0);
9052         expo.dst_ec = (ExeContext *)((void *)0);   9052         expo.dst_ec = (ExeContext *)((void *)0);
9053         if (laog_exposition) {   9053         if (laog_exposition) {
9054     9054  
9055         } else {   9055         } else {
9056           vgPlain_assert_fail((Bool )0, (Char const   *)"laog_exposition",   9056           vgPlain_assert_fail((Bool )0, (Char const   *)"laog_exposition",
9057                               (Char const   *)"hg_main.c", 3283,   9057                               (Char const   *)"hg_main.c", 3283,
9058                               (Char const   *)"laog__add_edge", "");   9058                               (Char const   *)"laog__add_edge", "");
9059         }   9059         }
9060         tmp___4 = vgPlain_lookupFM(laog_exposition, (UWord *)((void *)0),   9060         tmp___4 = vgPlain_lookupFM(laog_exposition, (UWord *)((void *)0),
9061                                    (UWord *)((void *)0),   9061                                    (UWord *)((void *)0),
9062                                    (UWord )((Word )(& expo)));   9062                                    (UWord )((Word )(& expo)));
9063         if (tmp___4) {   9063         if (tmp___4) {
9064     9064  
9065         } else {   9065         } else {
9066           tmp___3 = vgHelgrind_zalloc((HChar *)"hg.lae.3",   9066           tmp___3 = vgHelgrind_zalloc((HChar *)"hg.lae.3",
9067                                       (SizeT )sizeof(LAOGLinkExposition ));   9067                                       (SizeT )sizeof(LAOGLinkExposition ));
9068           expo2 = (LAOGLinkExposition *)tmp___3;   9068           expo2 = (LAOGLinkExposition *)tmp___3;
    -+ 9069           {
      9070           memset(expo2, 0, sizeof(LAOGLinkExposition ));
9069           expo2->src_ga = src->guestaddr; = 9071           expo2->src_ga = src->guestaddr;
    -+ 9072           }
9070           expo2->dst_ga = dst->guestaddr; = 9073           expo2->dst_ga = dst->guestaddr;
9071           expo2->src_ec = src->acquired_at;   9074           expo2->src_ec = src->acquired_at;
9072           expo2->dst_ec = dst->acquired_at;   9075           expo2->dst_ec = dst->acquired_at;
9073           vgPlain_addToFM(laog_exposition, (UWord )((Word )expo2),   9076           vgPlain_addToFM(laog_exposition, (UWord )((Word )expo2),
9074                           (UWord )((Word )((void *)0)));   9077                           (UWord )((Word )((void *)0)));
9075         }   9078         }
9076       } else {   9079       } else {
9077     9080  
9078       }   9081       }
9079     } else {   9082     } else {
9080     9083  
9081     }   9084     }
9082   } else {   9085   } else {
9083     9086  
9084   }   9087   }
9085   return;   9088   return;
9086 }   9089 }
9087 }   9090 }
9088 static void ( __attribute__((__noinline__)) laog__del_edge)(Lock *src ,   9091 static void ( __attribute__((__noinline__)) laog__del_edge)(Lock *src ,
9089                                                             Lock *dst )   9092                                                             Lock *dst )
9090 {   9093 {
9091   Word keyW ;   9094   Word keyW ;
9092   LAOGLinks *links ;   9095   LAOGLinks *links ;
9093   Bool tmp ;   9096   Bool tmp ;
9094   Bool tmp___0 ;   9097   Bool tmp___0 ;
9095     9098  
9096   {   9099   {
9097   keyW = (Word )0;   9100   keyW = (Word )0;
9098   links = (LAOGLinks *)((void *)0);   9101   links = (LAOGLinks *)((void *)0);
9099   tmp = vgPlain_lookupFM(laog, (UWord *)(& keyW), (UWord *)((Word *)(& links)),   9102   tmp = vgPlain_lookupFM(laog, (UWord *)(& keyW), (UWord *)((Word *)(& links)),
9100                          (UWord )((Word )src));   9103                          (UWord )((Word )src));
9101   if (tmp) {   9104   if (tmp) {
9102     if (links) {   9105     if (links) {
9103     9106  
9104     } else {   9107     } else {
9105       vgPlain_assert_fail((Bool )0, (Char const   *)"links",   9108       vgPlain_assert_fail((Bool )0, (Char const   *)"links",
9106                           (Char const   *)"hg_main.c", 3307,   9109                           (Char const   *)"hg_main.c", 3307,
9107                           (Char const   *)"laog__del_edge", "");   9110                           (Char const   *)"laog__del_edge", "");
9108     }   9111     }
9109     if (keyW == (Word )src) {   9112     if (keyW == (Word )src) {
9110     9113  
9111     } else {   9114     } else {
9112       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (Word)src",   9115       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (Word)src",
9113                           (Char const   *)"hg_main.c", 3308,   9116                           (Char const   *)"hg_main.c", 3308,
9114                           (Char const   *)"laog__del_edge", "");   9117                           (Char const   *)"laog__del_edge", "");
9115     }   9118     }
9116     links->outs = vgHelgrind_delFromWS(univ_laog, links->outs,   9119     links->outs = vgHelgrind_delFromWS(univ_laog, links->outs,
9117                                        (UWord )((Word )dst));   9120                                        (UWord )((Word )dst));
9118   } else {   9121   } else {
9119     9122  
9120   }   9123   }
9121   keyW = (Word )0;   9124   keyW = (Word )0;
9122   links = (LAOGLinks *)((void *)0);   9125   links = (LAOGLinks *)((void *)0);
9123   tmp___0 = vgPlain_lookupFM(laog, (UWord *)(& keyW),   9126   tmp___0 = vgPlain_lookupFM(laog, (UWord *)(& keyW),
9124                              (UWord *)((Word *)(& links)), (UWord )((Word )dst));   9127                              (UWord *)((Word *)(& links)), (UWord )((Word )dst));
9125   if (tmp___0) {   9128   if (tmp___0) {
9126     if (links) {   9129     if (links) {
9127     9130  
9128     } else {   9131     } else {
9129       vgPlain_assert_fail((Bool )0, (Char const   *)"links",   9132       vgPlain_assert_fail((Bool )0, (Char const   *)"links",
9130                           (Char const   *)"hg_main.c", 3315,   9133                           (Char const   *)"hg_main.c", 3315,
9131                           (Char const   *)"laog__del_edge", "");   9134                           (Char const   *)"laog__del_edge", "");
9132     }   9135     }
9133     if (keyW == (Word )dst) {   9136     if (keyW == (Word )dst) {
9134     9137  
9135     } else {   9138     } else {
9136       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (Word)dst",   9139       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (Word)dst",
9137                           (Char const   *)"hg_main.c", 3316,   9140                           (Char const   *)"hg_main.c", 3316,
9138                           (Char const   *)"laog__del_edge", "");   9141                           (Char const   *)"laog__del_edge", "");
9139     }   9142     }
9140     links->inns = vgHelgrind_delFromWS(univ_laog, links->inns,   9143     links->inns = vgHelgrind_delFromWS(univ_laog, links->inns,
9141                                        (UWord )((Word )src));   9144                                        (UWord )((Word )src));
9142   } else {   9145   } else {
9143     9146  
9144   }   9147   }
9145   return;   9148   return;
9146 }   9149 }
9147 }   9150 }
9148 static WordSetID ( __attribute__((__noinline__)) laog__succs)(Lock *lk )   9151 static WordSetID ( __attribute__((__noinline__)) laog__succs)(Lock *lk )
9149 {   9152 {
9150   Word keyW ;   9153   Word keyW ;
9151   LAOGLinks *links ;   9154   LAOGLinks *links ;
9152   WordSet tmp ;   9155   WordSet tmp ;
9153   Bool tmp___0 ;   9156   Bool tmp___0 ;
9154     9157  
9155   {   9158   {
9156   keyW = (Word )0;   9159   keyW = (Word )0;
9157   links = (LAOGLinks *)((void *)0);   9160   links = (LAOGLinks *)((void *)0);
9158   tmp___0 = vgPlain_lookupFM(laog, (UWord *)(& keyW),   9161   tmp___0 = vgPlain_lookupFM(laog, (UWord *)(& keyW),
9159                              (UWord *)((Word *)(& links)), (UWord )((Word )lk));   9162                              (UWord *)((Word *)(& links)), (UWord )((Word )lk));
9160   if (tmp___0) {   9163   if (tmp___0) {
9161     if (links) {   9164     if (links) {
9162     9165  
9163     } else {   9166     } else {
9164       vgPlain_assert_fail((Bool )0, (Char const   *)"links",   9167       vgPlain_assert_fail((Bool )0, (Char const   *)"links",
9165                           (Char const   *)"hg_main.c", 3328,   9168                           (Char const   *)"hg_main.c", 3328,
9166                           (Char const   *)"laog__succs", "");   9169                           (Char const   *)"laog__succs", "");
9167     }   9170     }
9168     if (keyW == (Word )lk) {   9171     if (keyW == (Word )lk) {
9169     9172  
9170     } else {   9173     } else {
9171       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (Word)lk",   9174       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (Word)lk",
9172                           (Char const   *)"hg_main.c", 3329,   9175                           (Char const   *)"hg_main.c", 3329,
9173                           (Char const   *)"laog__succs", "");   9176                           (Char const   *)"laog__succs", "");
9174     }   9177     }
9175     return (links->outs);   9178     return (links->outs);
9176   } else {   9179   } else {
9177     tmp = vgHelgrind_emptyWS(univ_laog);   9180     tmp = vgHelgrind_emptyWS(univ_laog);
9178     return (tmp);   9181     return (tmp);
9179   }   9182   }
9180 }   9183 }
9181 }   9184 }
9182 static WordSetID ( __attribute__((__noinline__)) laog__preds)(Lock *lk )   9185 static WordSetID ( __attribute__((__noinline__)) laog__preds)(Lock *lk )
9183 {   9186 {
9184   Word keyW ;   9187   Word keyW ;
9185   LAOGLinks *links ;   9188   LAOGLinks *links ;
9186   WordSet tmp ;   9189   WordSet tmp ;
9187   Bool tmp___0 ;   9190   Bool tmp___0 ;
9188     9191  
9189   {   9192   {
9190   keyW = (Word )0;   9193   keyW = (Word )0;
9191   links = (LAOGLinks *)((void *)0);   9194   links = (LAOGLinks *)((void *)0);
9192   tmp___0 = vgPlain_lookupFM(laog, (UWord *)(& keyW),   9195   tmp___0 = vgPlain_lookupFM(laog, (UWord *)(& keyW),
9193                              (UWord *)((Word *)(& links)), (UWord )((Word )lk));   9196                              (UWord *)((Word *)(& links)), (UWord )((Word )lk));
9194   if (tmp___0) {   9197   if (tmp___0) {
9195     if (links) {   9198     if (links) {
9196     9199  
9197     } else {   9200     } else {
9198       vgPlain_assert_fail((Bool )0, (Char const   *)"links",   9201       vgPlain_assert_fail((Bool )0, (Char const   *)"links",
9199                           (Char const   *)"hg_main.c", 3343,   9202                           (Char const   *)"hg_main.c", 3343,
9200                           (Char const   *)"laog__preds", "");   9203                           (Char const   *)"laog__preds", "");
9201     }   9204     }
9202     if (keyW == (Word )lk) {   9205     if (keyW == (Word )lk) {
9203     9206  
9204     } else {   9207     } else {
9205       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (Word)lk",   9208       vgPlain_assert_fail((Bool )0, (Char const   *)"keyW == (Word)lk",
9206                           (Char const   *)"hg_main.c", 3344,   9209                           (Char const   *)"hg_main.c", 3344,
9207                           (Char const   *)"laog__preds", "");   9210                           (Char const   *)"laog__preds", "");
9208     }   9211     }
9209     return (links->inns);   9212     return (links->inns);
9210   } else {   9213   } else {
9211     tmp = vgHelgrind_emptyWS(univ_laog);   9214     tmp = vgHelgrind_emptyWS(univ_laog);
9212     return (tmp);   9215     return (tmp);
9213   }   9216   }
9214 }   9217 }
9215 }   9218 }
9216 static void ( __attribute__((__noinline__)) laog__sanity_check)(Char *who )   9219 static void ( __attribute__((__noinline__)) laog__sanity_check)(Char *who )
9217 {   9220 {
9218   Word i ;   9221   Word i ;
9219   Word ws_size ;   9222   Word ws_size ;
9220   UWord *ws_words ;   9223   UWord *ws_words ;
9221   Lock *me ;   9224   Lock *me ;
9222   LAOGLinks *links ;   9225   LAOGLinks *links ;
9223   WordSetID tmp ;   9226   WordSetID tmp ;
9224   Bool tmp___0 ;   9227   Bool tmp___0 ;
9225   WordSetID tmp___1 ;   9228   WordSetID tmp___1 ;
9226   Bool tmp___2 ;   9229   Bool tmp___2 ;
9227   Bool tmp___3 ;   9230   Bool tmp___3 ;
9228     9231  
9229   {   9232   {
9230   vgPlain_initIterFM(laog);   9233   vgPlain_initIterFM(laog);
9231   me = (Lock *)((void *)0);   9234   me = (Lock *)((void *)0);
9232   links = (LAOGLinks *)((void *)0);   9235   links = (LAOGLinks *)((void *)0);
9233   while (1) {   9236   while (1) {
9234     tmp___3 = vgPlain_nextIterFM(laog, (UWord *)((Word *)(& me)),   9237     tmp___3 = vgPlain_nextIterFM(laog, (UWord *)((Word *)(& me)),
9235                                  (UWord *)((Word *)(& links)));   9238                                  (UWord *)((Word *)(& links)));
9236     if (tmp___3) {   9239     if (tmp___3) {
9237     9240  
9238     } else {   9241     } else {
9239       break;   9242       break;
9240     }   9243     }
9241     if (me) {   9244     if (me) {
9242     9245  
9243     } else {   9246     } else {
9244       vgPlain_assert_fail((Bool )0, (Char const   *)"me",   9247       vgPlain_assert_fail((Bool )0, (Char const   *)"me",
9245                           (Char const   *)"hg_main.c", 3363,   9248                           (Char const   *)"hg_main.c", 3363,
9246                           (Char const   *)"laog__sanity_check", "");   9249                           (Char const   *)"laog__sanity_check", "");
9247     }   9250     }
9248     if (links) {   9251     if (links) {
9249     9252  
9250     } else {   9253     } else {
9251       vgPlain_assert_fail((Bool )0, (Char const   *)"links",   9254       vgPlain_assert_fail((Bool )0, (Char const   *)"links",
9252                           (Char const   *)"hg_main.c", 3364,   9255                           (Char const   *)"hg_main.c", 3364,
9253                           (Char const   *)"laog__sanity_check", "");   9256                           (Char const   *)"laog__sanity_check", "");
9254     }   9257     }
9255     vgHelgrind_getPayloadWS(& ws_words, (UWord *)(& ws_size), univ_laog,   9258     vgHelgrind_getPayloadWS(& ws_words, (UWord *)(& ws_size), univ_laog,
9256                             links->inns);   9259                             links->inns);
9257     i = (Word )0;   9260     i = (Word )0;
9258     while (i < ws_size) {   9261     while (i < ws_size) {
9259       tmp = laog__succs((Lock *)*(ws_words + i));   9262       tmp = laog__succs((Lock *)*(ws_words + i));
9260       tmp___0 = vgHelgrind_elemWS(univ_laog, tmp, (UWord )((Word )me));   9263       tmp___0 = vgHelgrind_elemWS(univ_laog, tmp, (UWord )((Word )me));
9261       if (tmp___0) {   9264       if (tmp___0) {
9262     9265  
9263       } else {   9266       } else {
9264         goto bad;   9267         goto bad;
9265       }   9268       }
9266       i ++;   9269       i ++;
9267     }   9270     }
9268     vgHelgrind_getPayloadWS(& ws_words, (UWord *)(& ws_size), univ_laog,   9271     vgHelgrind_getPayloadWS(& ws_words, (UWord *)(& ws_size), univ_laog,
9269                             links->outs);   9272                             links->outs);
9270     i = (Word )0;   9273     i = (Word )0;
9271     while (i < ws_size) {   9274     while (i < ws_size) {
9272       tmp___1 = laog__preds((Lock *)*(ws_words + i));   9275       tmp___1 = laog__preds((Lock *)*(ws_words + i));
9273       tmp___2 = vgHelgrind_elemWS(univ_laog, tmp___1, (UWord )((Word )me));   9276       tmp___2 = vgHelgrind_elemWS(univ_laog, tmp___1, (UWord )((Word )me));
9274       if (tmp___2) {   9277       if (tmp___2) {
9275     9278  
9276       } else {   9279       } else {
9277         goto bad;   9280         goto bad;
9278       }   9281       }
9279       i ++;   9282       i ++;
9280     }   9283     }
9281     me = (Lock *)((void *)0);   9284     me = (Lock *)((void *)0);
9282     links = (LAOGLinks *)((void *)0);   9285     links = (LAOGLinks *)((void *)0);
9283   }   9286   }
9284   vgPlain_doneIterFM(laog);   9287   vgPlain_doneIterFM(laog);
9285   return;   9288   return;
9286   bad:   9289   bad:
9287   vgPlain_printf("laog__sanity_check(%s) FAILED\n", who);   9290   vgPlain_printf("laog__sanity_check(%s) FAILED\n", who);
9288   laog__show(who);   9291   laog__show(who);
9289   vgPlain_assert_fail((Bool )0, (Char const   *)"0",   9292   vgPlain_assert_fail((Bool )0, (Char const   *)"0",
9290                       (Char const   *)"hg_main.c", 3388,   9293                       (Char const   *)"hg_main.c", 3388,
9291                       (Char const   *)"laog__sanity_check", "");   9294                       (Char const   *)"laog__sanity_check", "");
9292 }   9295 }
9293 }   9296 }
9294 static Lock *( __attribute__((__noinline__)) laog__do_dfs_from_to)(Lock *src ,   9297 static Lock *( __attribute__((__noinline__)) laog__do_dfs_from_to)(Lock *src ,
9295                                                                    WordSetID dsts )   9298                                                                    WordSetID dsts )
9296 {   9299 {
9297   Lock *ret ;   9300   Lock *ret ;
9298   Word i ;   9301   Word i ;
9299   Word ssz ;   9302   Word ssz ;
9300   XArray *stack ;   9303   XArray *stack ;
9301   WordFM *visited ;   9304   WordFM *visited ;
9302   Lock *here ;   9305   Lock *here ;
9303   WordSetID succs ;   9306   WordSetID succs ;
9304   Word succs_size ;   9307   Word succs_size ;
9305   UWord *succs_words ;   9308   UWord *succs_words ;
9306   Bool tmp ;   9309   Bool tmp ;
9307   void *tmp___0 ;   9310   void *tmp___0 ;
9308   Bool tmp___1 ;   9311   Bool tmp___1 ;
9309   Bool tmp___2 ;   9312   Bool tmp___2 ;
9310     9313  
9311   {   9314   {
9312   tmp = vgHelgrind_isEmptyWS(univ_lsets, dsts);   9315   tmp = vgHelgrind_isEmptyWS(univ_lsets, dsts);
9313   if (tmp) {   9316   if (tmp) {
9314     return ((Lock *)((void *)0));   9317     return ((Lock *)((void *)0));
9315   } else {   9318   } else {
9316     9319  
9317   }   9320   }
9318   ret = (Lock *)((void *)0);   9321   ret = (Lock *)((void *)0);
9319   stack = vgPlain_newXA(& vgHelgrind_zalloc, (HChar *)"hg.lddft.1",   9322   stack = vgPlain_newXA(& vgHelgrind_zalloc, (HChar *)"hg.lddft.1",
9320                         & vgHelgrind_free, (Word )sizeof(Lock *));   9323                         & vgHelgrind_free, (Word )sizeof(Lock *));
9321   visited = vgPlain_newFM(& vgHelgrind_zalloc, (HChar *)"hg.lddft.2",   9324   visited = vgPlain_newFM(& vgHelgrind_zalloc, (HChar *)"hg.lddft.2",
9322                           & vgHelgrind_free,   9325                           & vgHelgrind_free,
9323                           (Word (*)(UWord  , UWord  ))((void *)0));   9326                           (Word (*)(UWord  , UWord  ))((void *)0));
9324   vgPlain_addToXA(stack, (void *)(& src));   9327   vgPlain_addToXA(stack, (void *)(& src));
9325   while (1) {   9328   while (1) {
9326     ssz = vgPlain_sizeXA(stack);   9329     ssz = vgPlain_sizeXA(stack);
9327     if (ssz == 0L) {   9330     if (ssz == 0L) {
9328       ret = (Lock *)((void *)0);   9331       ret = (Lock *)((void *)0);
9329       break;   9332       break;
9330     } else {   9333     } else {
9331     9334  
9332     }   9335     }
9333     tmp___0 = vgPlain_indexXA(stack, ssz - 1L);   9336     tmp___0 = vgPlain_indexXA(stack, ssz - 1L);
9334     here = *((Lock **)tmp___0);   9337     here = *((Lock **)tmp___0);
9335     vgPlain_dropTailXA(stack, (Word )1);   9338     vgPlain_dropTailXA(stack, (Word )1);
9336     tmp___1 = vgHelgrind_elemWS(univ_lsets, dsts, (UWord )((Word )here));   9339     tmp___1 = vgHelgrind_elemWS(univ_lsets, dsts, (UWord )((Word )here));
9337     if (tmp___1) {   9340     if (tmp___1) {
9338       ret = here;   9341       ret = here;
9339       break;   9342       break;
9340     } else {   9343     } else {
9341     9344  
9342     }   9345     }
9343     tmp___2 = vgPlain_lookupFM(visited, (UWord *)((void *)0),   9346     tmp___2 = vgPlain_lookupFM(visited, (UWord *)((void *)0),
9344                                (UWord *)((void *)0), (UWord )((Word )here));   9347                                (UWord *)((void *)0), (UWord )((Word )here));
9345     if (tmp___2) {   9348     if (tmp___2) {
9346       continue;   9349       continue;
9347     } else {   9350     } else {
9348     9351  
9349     }   9352     }
9350     vgPlain_addToFM(visited, (UWord )((Word )here), (UWord )0);   9353     vgPlain_addToFM(visited, (UWord )((Word )here), (UWord )0);
9351     succs = laog__succs(here);   9354     succs = laog__succs(here);
9352     vgHelgrind_getPayloadWS(& succs_words, (UWord *)(& succs_size), univ_laog,   9355     vgHelgrind_getPayloadWS(& succs_words, (UWord *)(& succs_size), univ_laog,
9353                             succs);   9356                             succs);
9354     i = (Word )0;   9357     i = (Word )0;
9355     while (i < succs_size) {   9358     while (i < succs_size) {
9356       vgPlain_addToXA(stack, (void *)(succs_words + i));   9359       vgPlain_addToXA(stack, (void *)(succs_words + i));
9357       i ++;   9360       i ++;
9358     }   9361     }
9359   }   9362   }
9360   vgPlain_deleteFM(visited, (void (*)(UWord  ))((void *)0),   9363   vgPlain_deleteFM(visited, (void (*)(UWord  ))((void *)0),
9361                    (void (*)(UWord  ))((void *)0));   9364                    (void (*)(UWord  ))((void *)0));
9362   vgPlain_deleteXA(stack);   9365   vgPlain_deleteXA(stack);
9363   return (ret);   9366   return (ret);
9364 }   9367 }
9365 }   9368 }
9366 static void ( __attribute__((__noinline__)) laog__pre_thread_acquires_lock)(Thread *thr ,   9369 static void ( __attribute__((__noinline__)) laog__pre_thread_acquires_lock)(Thread *thr ,
9367                                                                             Lock *lk )   9370                                                                             Lock *lk )
9368 {   9371 {
9369   UWord *ls_words ;   9372   UWord *ls_words ;
9370   Word ls_size ;   9373   Word ls_size ;
9371   Word i ;   9374   Word i ;
9372   Lock *other ;   9375   Lock *other ;
9373   Bool tmp ;   9376   Bool tmp ;
9374   LAOGLinkExposition key ;   9377   LAOGLinkExposition key ;
9375   LAOGLinkExposition *found ;   9378   LAOGLinkExposition *found ;
9376   Bool tmp___0 ;   9379   Bool tmp___0 ;
9377   Lock *old ;   9380   Lock *old ;
9378     9381  
9379   {   9382   {
9380   tmp = vgHelgrind_elemWS(univ_lsets, thr->locksetA, (UWord )((Word )lk));   9383   tmp = vgHelgrind_elemWS(univ_lsets, thr->locksetA, (UWord )((Word )lk));
9381   if (tmp) {   9384   if (tmp) {
9382     return;   9385     return;
9383   } else {   9386   } else {
9384     9387  
9385   }   9388   }
9386   other = laog__do_dfs_from_to(lk, thr->locksetA);   9389   other = laog__do_dfs_from_to(lk, thr->locksetA);
9387   if (other) {   9390   if (other) {
9388     key.src_ga = lk->guestaddr;   9391     key.src_ga = lk->guestaddr;
9389     key.dst_ga = other->guestaddr;   9392     key.dst_ga = other->guestaddr;
9390     key.src_ec = (ExeContext *)((void *)0);   9393     key.src_ec = (ExeContext *)((void *)0);
9391     key.dst_ec = (ExeContext *)((void *)0);   9394     key.dst_ec = (ExeContext *)((void *)0);
9392     found = (LAOGLinkExposition *)((void *)0);   9395     found = (LAOGLinkExposition *)((void *)0);
9393     tmp___0 = vgPlain_lookupFM(laog_exposition, (UWord *)((Word *)(& found)),   9396     tmp___0 = vgPlain_lookupFM(laog_exposition, (UWord *)((Word *)(& found)),
9394                                (UWord *)((void *)0), (UWord )((Word )(& key)));   9397                                (UWord *)((void *)0), (UWord )((Word )(& key)));
9395     if (tmp___0) {   9398     if (tmp___0) {
9396       if ((unsigned int )found != (unsigned int )(& key)) {   9399       if ((unsigned int )found != (unsigned int )(& key)) {
9397     9400  
9398       } else {   9401       } else {
9399         vgPlain_assert_fail((Bool )0, (Char const   *)"found != &key",   9402         vgPlain_assert_fail((Bool )0, (Char const   *)"found != &key",
9400                             (Char const   *)"hg_main.c", 3491,   9403                             (Char const   *)"hg_main.c", 3491,
9401                             (Char const   *)"laog__pre_thread_acquires_lock", "");   9404                             (Char const   *)"laog__pre_thread_acquires_lock", "");
9402       }   9405       }
9403       if (found->src_ga == key.src_ga) {   9406       if (found->src_ga == key.src_ga) {
9404     9407  
9405       } else {   9408       } else {
9406         vgPlain_assert_fail((Bool )0,   9409         vgPlain_assert_fail((Bool )0,
9407                             (Char const   *)"found->src_ga == key.src_ga",   9410                             (Char const   *)"found->src_ga == key.src_ga",
9408                             (Char const   *)"hg_main.c", 3492,   9411                             (Char const   *)"hg_main.c", 3492,
9409                             (Char const   *)"laog__pre_thread_acquires_lock", "");   9412                             (Char const   *)"laog__pre_thread_acquires_lock", "");
9410       }   9413       }
9411       if (found->dst_ga == key.dst_ga) {   9414       if (found->dst_ga == key.dst_ga) {
9412     9415  
9413       } else {   9416       } else {
9414         vgPlain_assert_fail((Bool )0,   9417         vgPlain_assert_fail((Bool )0,
9415                             (Char const   *)"found->dst_ga == key.dst_ga",   9418                             (Char const   *)"found->dst_ga == key.dst_ga",
9416                             (Char const   *)"hg_main.c", 3493,   9419                             (Char const   *)"hg_main.c", 3493,
9417                             (Char const   *)"laog__pre_thread_acquires_lock", "");   9420                             (Char const   *)"laog__pre_thread_acquires_lock", "");
9418       }   9421       }
9419       if (found->src_ec) {   9422       if (found->src_ec) {
9420     9423  
9421       } else {   9424       } else {
9422         vgPlain_assert_fail((Bool )0, (Char const   *)"found->src_ec",   9425         vgPlain_assert_fail((Bool )0, (Char const   *)"found->src_ec",
9423                             (Char const   *)"hg_main.c", 3494,   9426                             (Char const   *)"hg_main.c", 3494,
9424                             (Char const   *)"laog__pre_thread_acquires_lock", "");   9427                             (Char const   *)"laog__pre_thread_acquires_lock", "");
9425       }   9428       }
9426       if (found->dst_ec) {   9429       if (found->dst_ec) {
9427     9430  
9428       } else {   9431       } else {
9429         vgPlain_assert_fail((Bool )0, (Char const   *)"found->dst_ec",   9432         vgPlain_assert_fail((Bool )0, (Char const   *)"found->dst_ec",
9430                             (Char const   *)"hg_main.c", 3495,   9433                             (Char const   *)"hg_main.c", 3495,
9431                             (Char const   *)"laog__pre_thread_acquires_lock", "");   9434                             (Char const   *)"laog__pre_thread_acquires_lock", "");
9432       }   9435       }
9433       vgHelgrind_record_error_LockOrder(thr, lk->guestaddr, other->guestaddr,   9436       vgHelgrind_record_error_LockOrder(thr, lk->guestaddr, other->guestaddr,
9434                                         found->src_ec, found->dst_ec);   9437                                         found->src_ec, found->dst_ec);
9435     } else {   9438     } else {
9436       vgHelgrind_record_error_LockOrder(thr, lk->guestaddr, other->guestaddr,   9439       vgHelgrind_record_error_LockOrder(thr, lk->guestaddr, other->guestaddr,
9437                                         (ExeContext *)((void *)0),   9440                                         (ExeContext *)((void *)0),
9438                                         (ExeContext *)((void *)0));   9441                                         (ExeContext *)((void *)0));
9439     }   9442     }
9440   } else {   9443   } else {
9441     9444  
9442   }   9445   }
9443   if (lk->acquired_at) {   9446   if (lk->acquired_at) {
9444     9447  
9445   } else {   9448   } else {
9446     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->acquired_at",   9449     vgPlain_assert_fail((Bool )0, (Char const   *)"lk->acquired_at",
9447                         (Char const   *)"hg_main.c", 3512,   9450                         (Char const   *)"hg_main.c", 3512,
9448                         (Char const   *)"laog__pre_thread_acquires_lock", "");   9451                         (Char const   *)"laog__pre_thread_acquires_lock", "");
9449   }   9452   }
9450   vgHelgrind_getPayloadWS(& ls_words, (UWord *)(& ls_size), univ_lsets,   9453   vgHelgrind_getPayloadWS(& ls_words, (UWord *)(& ls_size), univ_lsets,
9451                           thr->locksetA);   9454                           thr->locksetA);
9452   i = (Word )0;   9455   i = (Word )0;
9453   while (i < ls_size) {   9456   while (i < ls_size) {
9454     old = (Lock *)*(ls_words + i);   9457     old = (Lock *)*(ls_words + i);
9455     if (old->acquired_at) {   9458     if (old->acquired_at) {
9456     9459  
9457     } else {   9460     } else {
9458       vgPlain_assert_fail((Bool )0, (Char const   *)"old->acquired_at",   9461       vgPlain_assert_fail((Bool )0, (Char const   *)"old->acquired_at",
9459                           (Char const   *)"hg_main.c", 3516,   9462                           (Char const   *)"hg_main.c", 3516,
9460                           (Char const   *)"laog__pre_thread_acquires_lock", "");   9463                           (Char const   *)"laog__pre_thread_acquires_lock", "");
9461     }   9464     }
9462     laog__add_edge(old, lk);   9465     laog__add_edge(old, lk);
9463     i ++;   9466     i ++;
9464   }   9467   }
9465   if (vgHelgrind_clo_sanity_flags & (long )(1 << 4)) {   9468   if (vgHelgrind_clo_sanity_flags & (long )(1 << 4)) {
9466     all_except_Locks__sanity_check((Char *)"laog__pre_thread_acquires_lock-post");   9469     all_except_Locks__sanity_check((Char *)"laog__pre_thread_acquires_lock-post");
9467   } else {   9470   } else {
9468     9471  
9469   }   9472   }
9470   return;   9473   return;
9471 }   9474 }
9472 }   9475 }
9473 static void ( __attribute__((__noinline__)) laog__handle_one_lock_deletion)(Lock *lk )   9476 static void ( __attribute__((__noinline__)) laog__handle_one_lock_deletion)(Lock *lk )
9474 {   9477 {
9475   WordSetID preds ;   9478   WordSetID preds ;
9476   WordSetID succs ;   9479   WordSetID succs ;
9477   Word preds_size ;   9480   Word preds_size ;
9478   Word succs_size ;   9481   Word succs_size ;
9479   Word i ;   9482   Word i ;
9480   Word j ;   9483   Word j ;
9481   UWord *preds_words ;   9484   UWord *preds_words ;
9482   UWord *succs_words ;   9485   UWord *succs_words ;
9483     9486  
9484   {   9487   {
9485   preds = laog__preds(lk);   9488   preds = laog__preds(lk);
9486   succs = laog__succs(lk);   9489   succs = laog__succs(lk);
9487   vgHelgrind_getPayloadWS(& preds_words, (UWord *)(& preds_size), univ_laog,   9490   vgHelgrind_getPayloadWS(& preds_words, (UWord *)(& preds_size), univ_laog,
9488                           preds);   9491                           preds);
9489   i = (Word )0;   9492   i = (Word )0;
9490   while (i < preds_size) {   9493   while (i < preds_size) {
9491     laog__del_edge((Lock *)*(preds_words + i), lk);   9494     laog__del_edge((Lock *)*(preds_words + i), lk);
9492     i ++;   9495     i ++;
9493   }   9496   }
9494   vgHelgrind_getPayloadWS(& succs_words, (UWord *)(& succs_size), univ_laog,   9497   vgHelgrind_getPayloadWS(& succs_words, (UWord *)(& succs_size), univ_laog,
9495                           succs);   9498                           succs);
9496   j = (Word )0;   9499   j = (Word )0;
9497   while (j < succs_size) {   9500   while (j < succs_size) {
9498     laog__del_edge(lk, (Lock *)*(succs_words + j));   9501     laog__del_edge(lk, (Lock *)*(succs_words + j));
9499     j ++;   9502     j ++;
9500   }   9503   }
9501   i = (Word )0;   9504   i = (Word )0;
9502   while (i < preds_size) {   9505   while (i < preds_size) {
9503     j = (Word )0;   9506     j = (Word )0;
9504     while (j < succs_size) {   9507     while (j < succs_size) {
9505       if (*(preds_words + i) != *(succs_words + j)) {   9508       if (*(preds_words + i) != *(succs_words + j)) {
9506         laog__add_edge((Lock *)*(preds_words + i), (Lock *)*(succs_words + j));   9509         laog__add_edge((Lock *)*(preds_words + i), (Lock *)*(succs_words + j));
9507       } else {   9510       } else {
9508     9511  
9509       }   9512       }
9510       j ++;   9513       j ++;
9511     }   9514     }
9512     i ++;   9515     i ++;
9513   }   9516   }
9514   return;   9517   return;
9515 }   9518 }
9516 }   9519 }
9517 static VgHashTable hg_mallocmeta_table  =    (VgHashTable )((void *)0);   9520 static VgHashTable hg_mallocmeta_table  =    (VgHashTable )((void *)0);
9518 static MallocMeta *new_MallocMeta(void)   9521 static MallocMeta *new_MallocMeta(void)
9519 {   9522 {
9520   MallocMeta *md ;   9523   MallocMeta *md ;
9521   void *tmp ;   9524   void *tmp ;
9522     9525  
9523   {   9526   {
9524   tmp = vgHelgrind_zalloc((HChar *)"hg.new_MallocMeta.1",   9527   tmp = vgHelgrind_zalloc((HChar *)"hg.new_MallocMeta.1",
9525                           (SizeT )sizeof(MallocMeta ));   9528                           (SizeT )sizeof(MallocMeta ));
9526   md = (MallocMeta *)tmp;   9529   md = (MallocMeta *)tmp;
9527   if (md) {   9530   if (md) {
9528     9531  
9529   } else {   9532   } else {
9530     vgPlain_assert_fail((Bool )0, (Char const   *)"md",   9533     vgPlain_assert_fail((Bool )0, (Char const   *)"md",
9531                         (Char const   *)"hg_main.c", 3601,   9534                         (Char const   *)"hg_main.c", 3601,
9532                         (Char const   *)"new_MallocMeta", "");   9535                         (Char const   *)"new_MallocMeta", "");
9533   }   9536   }
9534   return (md);   9537   return (md);
9535 }   9538 }
9536 }   9539 }
9537 static void delete_MallocMeta(MallocMeta *md )   9540 static void delete_MallocMeta(MallocMeta *md )
9538 {   9541 {
9539     9542  
9540     9543  
9541   {   9544   {
9542   vgHelgrind_free((void *)md);   9545   vgHelgrind_free((void *)md);
9543   return;   9546   return;
9544 }   9547 }
9545 }   9548 }
9546 static void *handle_alloc(ThreadId tid , SizeT szB , SizeT alignB ,   9549 static void *handle_alloc(ThreadId tid , SizeT szB , SizeT alignB ,
9547                           Bool is_zeroed )   9550                           Bool is_zeroed )
9548 {   9551 {
9549   Addr p ;   9552   Addr p ;
9550   MallocMeta *md ;   9553   MallocMeta *md ;
9551   void *tmp ;   9554   void *tmp ;
9552     9555  
9553   {   9556   {
9554   if ((SSizeT )szB >= 0L) {   9557   if ((SSizeT )szB >= 0L) {
9555     9558  
9556   } else {   9559   } else {
9557     vgPlain_assert_fail((Bool )0, (Char const   *)"((SSizeT)szB) >= 0",   9560     vgPlain_assert_fail((Bool )0, (Char const   *)"((SSizeT)szB) >= 0",
9558                         (Char const   *)"hg_main.c", 3618,   9561                         (Char const   *)"hg_main.c", 3618,
9559                         (Char const   *)"handle_alloc", "");   9562                         (Char const   *)"handle_alloc", "");
9560   }   9563   }
9561   tmp = vgPlain_cli_malloc(alignB, szB);   9564   tmp = vgPlain_cli_malloc(alignB, szB);
9562   p = (Addr )tmp;   9565   p = (Addr )tmp;
9563   if (! p) {   9566   if (! p) {
9564     return ((void *)0);   9567     return ((void *)0);
9565   } else {   9568   } else {
9566     9569  
9567   }   9570   }
9568   if (is_zeroed) {   9571   if (is_zeroed) {
9569     vgPlain_memset((void *)p, 0, szB);   9572     vgPlain_memset((void *)p, 0, szB);
9570   } else {   9573   } else {
9571     9574  
9572   }   9575   }
9573   md = new_MallocMeta();   9576   md = new_MallocMeta();
9574   md->payload = p;   9577   md->payload = p;
9575   md->szB = szB;   9578   md->szB = szB;
9576   md->where = vgPlain_record_ExeContext(tid, (Word )0);   9579   md->where = vgPlain_record_ExeContext(tid, (Word )0);
9577   md->thr = map_threads_lookup(tid);   9580   md->thr = map_threads_lookup(tid);
9578   vgPlain_HT_add_node(hg_mallocmeta_table, (void *)((VgHashNode *)md));   9581   vgPlain_HT_add_node(hg_mallocmeta_table, (void *)((VgHashNode *)md));
9579   evh__new_mem_heap(p, szB, is_zeroed);   9582   evh__new_mem_heap(p, szB, is_zeroed);
9580   return ((void *)p);   9583   return ((void *)p);
9581 }   9584 }
9582 }   9585 }
9583 static void *hg_cli__malloc(ThreadId tid , SizeT n )   9586 static void *hg_cli__malloc(ThreadId tid , SizeT n )
9584 {   9587 {
9585   void *tmp ;   9588   void *tmp ;
9586     9589  
9587   {   9590   {
9588   if ((SSizeT )n < 0L) {   9591   if ((SSizeT )n < 0L) {
9589     return ((void *)0);   9592     return ((void *)0);
9590   } else {   9593   } else {
9591     9594  
9592   }   9595   }
9593   tmp = handle_alloc(tid, n, (SizeT )vgPlain_clo_alignment, (Bool )0);   9596   tmp = handle_alloc(tid, n, (SizeT )vgPlain_clo_alignment, (Bool )0);
9594   return (tmp);   9597   return (tmp);
9595 }   9598 }
9596 }   9599 }
9597 static void *hg_cli____builtin_new(ThreadId tid , SizeT n )   9600 static void *hg_cli____builtin_new(ThreadId tid , SizeT n )
9598 {   9601 {
9599   void *tmp ;   9602   void *tmp ;
9600     9603  
9601   {   9604   {
9602   if ((SSizeT )n < 0L) {   9605   if ((SSizeT )n < 0L) {
9603     return ((void *)0);   9606     return ((void *)0);
9604   } else {   9607   } else {
9605     9608  
9606   }   9609   }
9607   tmp = handle_alloc(tid, n, (SizeT )vgPlain_clo_alignment, (Bool )0);   9610   tmp = handle_alloc(tid, n, (SizeT )vgPlain_clo_alignment, (Bool )0);
9608   return (tmp);   9611   return (tmp);
9609 }   9612 }
9610 }   9613 }
9611 static void *hg_cli____builtin_vec_new(ThreadId tid , SizeT n )   9614 static void *hg_cli____builtin_vec_new(ThreadId tid , SizeT n )
9612 {   9615 {
9613   void *tmp ;   9616   void *tmp ;
9614     9617  
9615   {   9618   {
9616   if ((SSizeT )n < 0L) {   9619   if ((SSizeT )n < 0L) {
9617     return ((void *)0);   9620     return ((void *)0);
9618   } else {   9621   } else {
9619     9622  
9620   }   9623   }
9621   tmp = handle_alloc(tid, n, (SizeT )vgPlain_clo_alignment, (Bool )0);   9624   tmp = handle_alloc(tid, n, (SizeT )vgPlain_clo_alignment, (Bool )0);
9622   return (tmp);   9625   return (tmp);
9623 }   9626 }
9624 }   9627 }
9625 static void *hg_cli__memalign(ThreadId tid , SizeT align , SizeT n )   9628 static void *hg_cli__memalign(ThreadId tid , SizeT align , SizeT n )
9626 {   9629 {
9627   void *tmp ;   9630   void *tmp ;
9628     9631  
9629   {   9632   {
9630   if ((SSizeT )n < 0L) {   9633   if ((SSizeT )n < 0L) {
9631     return ((void *)0);   9634     return ((void *)0);
9632   } else {   9635   } else {
9633     9636  
9634   }   9637   }
9635   tmp = handle_alloc(tid, n, align, (Bool )0);   9638   tmp = handle_alloc(tid, n, align, (Bool )0);
9636   return (tmp);   9639   return (tmp);
9637 }   9640 }
9638 }   9641 }
9639 static void *hg_cli__calloc(ThreadId tid , SizeT nmemb , SizeT size1 )   9642 static void *hg_cli__calloc(ThreadId tid , SizeT nmemb , SizeT size1 )
9640 {   9643 {
9641   void *tmp ;   9644   void *tmp ;
9642     9645  
9643   {   9646   {
9644   if ((SSizeT )nmemb < 0L) {   9647   if ((SSizeT )nmemb < 0L) {
9645     return ((void *)0);   9648     return ((void *)0);
9646   } else   9649   } else
9647   if ((SSizeT )size1 < 0L) {   9650   if ((SSizeT )size1 < 0L) {
9648     return ((void *)0);   9651     return ((void *)0);
9649   } else {   9652   } else {
9650     9653  
9651   }   9654   }
9652   tmp = handle_alloc(tid, nmemb * size1, (SizeT )vgPlain_clo_alignment, (Bool )1);   9655   tmp = handle_alloc(tid, nmemb * size1, (SizeT )vgPlain_clo_alignment, (Bool )1);
9653   return (tmp);   9656   return (tmp);
9654 }   9657 }
9655 }   9658 }
9656 static void handle_free(ThreadId tid , void *p )   9659 static void handle_free(ThreadId tid , void *p )
9657 {   9660 {
9658   MallocMeta *md ;   9661   MallocMeta *md ;
9659   MallocMeta *old_md ;   9662   MallocMeta *old_md ;
9660   SizeT szB ;   9663   SizeT szB ;
9661   void *tmp ;   9664   void *tmp ;
9662   void *tmp___0 ;   9665   void *tmp___0 ;
9663     9666  
9664   {   9667   {
9665   tmp = vgPlain_HT_lookup(hg_mallocmeta_table, (UWord )p);   9668   tmp = vgPlain_HT_lookup(hg_mallocmeta_table, (UWord )p);
9666   md = (MallocMeta *)tmp;   9669   md = (MallocMeta *)tmp;
9667   if (! md) {   9670   if (! md) {
9668     return;   9671     return;
9669   } else {   9672   } else {
9670     9673  
9671   }   9674   }
9672   if (md->payload == (Addr )p) {   9675   if (md->payload == (Addr )p) {
9673     9676  
9674   } else {   9677   } else {
9675     vgPlain_assert_fail((Bool )0, (Char const   *)"md->payload == (Addr)p",   9678     vgPlain_assert_fail((Bool )0, (Char const   *)"md->payload == (Addr)p",
9676                         (Char const   *)"hg_main.c", 3688,   9679                         (Char const   *)"hg_main.c", 3688,
9677                         (Char const   *)"handle_free", "");   9680                         (Char const   *)"handle_free", "");
9678   }   9681   }
9679   szB = md->szB;   9682   szB = md->szB;
9680   tmp___0 = vgPlain_HT_remove(hg_mallocmeta_table, (UWord )p);   9683   tmp___0 = vgPlain_HT_remove(hg_mallocmeta_table, (UWord )p);
9681   old_md = (MallocMeta *)tmp___0;   9684   old_md = (MallocMeta *)tmp___0;
9682   if (old_md) {   9685   if (old_md) {
9683     9686  
9684   } else {   9687   } else {
9685     vgPlain_assert_fail((Bool )0, (Char const   *)"old_md",   9688     vgPlain_assert_fail((Bool )0, (Char const   *)"old_md",
9686                         (Char const   *)"hg_main.c", 3694,   9689                         (Char const   *)"hg_main.c", 3694,
9687                         (Char const   *)"handle_free", "");   9690                         (Char const   *)"handle_free", "");
9688   }   9691   }
9689   if ((unsigned int )old_md == (unsigned int )md) {   9692   if ((unsigned int )old_md == (unsigned int )md) {
9690     9693  
9691   } else {   9694   } else {
9692     vgPlain_assert_fail((Bool )0, (Char const   *)"old_md == md",   9695     vgPlain_assert_fail((Bool )0, (Char const   *)"old_md == md",
9693                         (Char const   *)"hg_main.c", 3695,   9696                         (Char const   *)"hg_main.c", 3695,
9694                         (Char const   *)"handle_free", "");   9697                         (Char const   *)"handle_free", "");
9695   }   9698   }
9696   if (old_md->payload == (Addr )p) {   9699   if (old_md->payload == (Addr )p) {
9697     9700  
9698   } else {   9701   } else {
9699     vgPlain_assert_fail((Bool )0, (Char const   *)"old_md->payload == (Addr)p",   9702     vgPlain_assert_fail((Bool )0, (Char const   *)"old_md->payload == (Addr)p",
9700                         (Char const   *)"hg_main.c", 3696,   9703                         (Char const   *)"hg_main.c", 3696,
9701                         (Char const   *)"handle_free", "");   9704                         (Char const   *)"handle_free", "");
9702   }   9705   }
9703   vgPlain_cli_free((void *)old_md->payload);   9706   vgPlain_cli_free((void *)old_md->payload);
9704   delete_MallocMeta(old_md);   9707   delete_MallocMeta(old_md);
9705   evh__die_mem_heap((Addr )p, szB);   9708   evh__die_mem_heap((Addr )p, szB);
9706   return;   9709   return;
9707 }   9710 }
9708 }   9711 }
9709 static void hg_cli__free(ThreadId tid , void *p )   9712 static void hg_cli__free(ThreadId tid , void *p )
9710 {   9713 {
9711     9714  
9712     9715  
9713   {   9716   {
9714   handle_free(tid, p);   9717   handle_free(tid, p);
9715   return;   9718   return;
9716 }   9719 }
9717 }   9720 }
9718 static void hg_cli____builtin_delete(ThreadId tid , void *p )   9721 static void hg_cli____builtin_delete(ThreadId tid , void *p )
9719 {   9722 {
9720     9723  
9721     9724  
9722   {   9725   {
9723   handle_free(tid, p);   9726   handle_free(tid, p);
9724   return;   9727   return;
9725 }   9728 }
9726 }   9729 }
9727 static void hg_cli____builtin_vec_delete(ThreadId tid , void *p )   9730 static void hg_cli____builtin_vec_delete(ThreadId tid , void *p )
9728 {   9731 {
9729     9732  
9730     9733  
9731   {   9734   {
9732   handle_free(tid, p);   9735   handle_free(tid, p);
9733   return;   9736   return;
9734 }   9737 }
9735 }   9738 }
9736 static void *hg_cli__realloc(ThreadId tid , void *payloadV , SizeT new_size )   9739 static void *hg_cli__realloc(ThreadId tid , void *payloadV , SizeT new_size )
9737 {   9740 {
9738   MallocMeta *md ;   9741   MallocMeta *md ;
9739   MallocMeta *md_new ;   9742   MallocMeta *md_new ;
9740   MallocMeta *md_tmp ;   9743   MallocMeta *md_tmp ;
9741   SizeT i ;   9744   SizeT i ;
9742   Addr payload ;   9745   Addr payload ;
9743   void *tmp ;   9746   void *tmp ;
9744   Addr p_new ;   9747   Addr p_new ;
9745   void *tmp___0 ;   9748   void *tmp___0 ;
9746   void *tmp___1 ;   9749   void *tmp___1 ;
9747     9750  
9748   {   9751   {
9749   payload = (Addr )payloadV;   9752   payload = (Addr )payloadV;
9750   if ((SSizeT )new_size < 0L) {   9753   if ((SSizeT )new_size < 0L) {
9751     return ((void *)0);   9754     return ((void *)0);
9752   } else {   9755   } else {
9753     9756  
9754   }   9757   }
9755   tmp = vgPlain_HT_lookup(hg_mallocmeta_table, payload);   9758   tmp = vgPlain_HT_lookup(hg_mallocmeta_table, payload);
9756   md = (MallocMeta *)tmp;   9759   md = (MallocMeta *)tmp;
9757   if (! md) {   9760   if (! md) {
9758     return ((void *)0);   9761     return ((void *)0);
9759   } else {   9762   } else {
9760     9763  
9761   }   9764   }
9762   if (md->payload == payload) {   9765   if (md->payload == payload) {
9763     9766  
9764   } else {   9767   } else {
9765     vgPlain_assert_fail((Bool )0, (Char const   *)"md->payload == payload",   9768     vgPlain_assert_fail((Bool )0, (Char const   *)"md->payload == payload",
9766                         (Char const   *)"hg_main.c", 3729,   9769                         (Char const   *)"hg_main.c", 3729,
9767                         (Char const   *)"hg_cli__realloc", "");   9770                         (Char const   *)"hg_cli__realloc", "");
9768   }   9771   }
9769   if (md->szB == new_size) {   9772   if (md->szB == new_size) {
9770     md->where = vgPlain_record_ExeContext(tid, (Word )0);   9773     md->where = vgPlain_record_ExeContext(tid, (Word )0);
9771     return (payloadV);   9774     return (payloadV);
9772   } else {   9775   } else {
9773     9776  
9774   }   9777   }
9775   if (md->szB > new_size) {   9778   if (md->szB > new_size) {
9776     md->szB = new_size;   9779     md->szB = new_size;
9777     md->where = vgPlain_record_ExeContext(tid, (Word )0);   9780     md->where = vgPlain_record_ExeContext(tid, (Word )0);
9778     evh__die_mem_heap(md->payload + new_size, md->szB - new_size);   9781     evh__die_mem_heap(md->payload + new_size, md->szB - new_size);
9779     return (payloadV);   9782     return (payloadV);
9780   } else {   9783   } else {
9781     9784  
9782   }   9785   }
9783   tmp___0 = vgPlain_cli_malloc((SizeT )vgPlain_clo_alignment, new_size);   9786   tmp___0 = vgPlain_cli_malloc((SizeT )vgPlain_clo_alignment, new_size);
9784   p_new = (Addr )tmp___0;   9787   p_new = (Addr )tmp___0;
9785   evh__copy_mem(payload, p_new, md->szB);   9788   evh__copy_mem(payload, p_new, md->szB);
9786   evh__new_mem_heap(p_new + md->szB, new_size - md->szB, (Bool )0);   9789   evh__new_mem_heap(p_new + md->szB, new_size - md->szB, (Bool )0);
9787   evh__die_mem_heap(payload, md->szB);   9790   evh__die_mem_heap(payload, md->szB);
9788   i = (SizeT )0;   9791   i = (SizeT )0;
9789   while (i < md->szB) {   9792   while (i < md->szB) {
9790     *((UChar *)p_new + i) = *((UChar *)payload + i);   9793     *((UChar *)p_new + i) = *((UChar *)payload + i);
9791     i ++;   9794     i ++;
9792   }   9795   }
9793   md_new = new_MallocMeta();   9796   md_new = new_MallocMeta();
9794   *md_new = *md;   9797   *md_new = *md;
9795   tmp___1 = vgPlain_HT_remove(hg_mallocmeta_table, payload);   9798   tmp___1 = vgPlain_HT_remove(hg_mallocmeta_table, payload);
9796   md_tmp = (MallocMeta *)tmp___1;   9799   md_tmp = (MallocMeta *)tmp___1;
9797   if (md_tmp) {   9800   if (md_tmp) {
9798     9801  
9799   } else {   9802   } else {
9800     vgPlain_assert_fail((Bool )0, (Char const   *)"md_tmp",   9803     vgPlain_assert_fail((Bool )0, (Char const   *)"md_tmp",
9801                         (Char const   *)"hg_main.c", 3773,   9804                         (Char const   *)"hg_main.c", 3773,
9802                         (Char const   *)"hg_cli__realloc", "");   9805                         (Char const   *)"hg_cli__realloc", "");
9803   }   9806   }
9804   if ((unsigned int )md_tmp == (unsigned int )md) {   9807   if ((unsigned int )md_tmp == (unsigned int )md) {
9805     9808  
9806   } else {   9809   } else {
9807     vgPlain_assert_fail((Bool )0, (Char const   *)"md_tmp == md",   9810     vgPlain_assert_fail((Bool )0, (Char const   *)"md_tmp == md",
9808                         (Char const   *)"hg_main.c", 3774,   9811                         (Char const   *)"hg_main.c", 3774,
9809                         (Char const   *)"hg_cli__realloc", "");   9812                         (Char const   *)"hg_cli__realloc", "");
9810   }   9813   }
9811   vgPlain_cli_free((void *)md->payload);   9814   vgPlain_cli_free((void *)md->payload);
9812   delete_MallocMeta(md);   9815   delete_MallocMeta(md);
9813   md_new->where = vgPlain_record_ExeContext(tid, (Word )0);   9816   md_new->where = vgPlain_record_ExeContext(tid, (Word )0);
9814   md_new->szB = new_size;   9817   md_new->szB = new_size;
9815   md_new->payload = p_new;   9818   md_new->payload = p_new;
9816   md_new->thr = map_threads_lookup(tid);   9819   md_new->thr = map_threads_lookup(tid);
9817   vgPlain_HT_add_node(hg_mallocmeta_table, (void *)((VgHashNode *)md_new));   9820   vgPlain_HT_add_node(hg_mallocmeta_table, (void *)((VgHashNode *)md_new));
9818   return ((void *)p_new);   9821   return ((void *)p_new);
9819 }   9822 }
9820 }   9823 }
9821 static SizeT hg_cli_malloc_usable_size(ThreadId tid , void *p )   9824 static SizeT hg_cli_malloc_usable_size(ThreadId tid , void *p )
9822 {   9825 {
9823   MallocMeta *md ;   9826   MallocMeta *md ;
9824   void *tmp ;   9827   void *tmp ;
9825   SizeT tmp___0 ;   9828   SizeT tmp___0 ;
9826     9829  
9827   {   9830   {
9828   tmp = vgPlain_HT_lookup(hg_mallocmeta_table, (UWord )p);   9831   tmp = vgPlain_HT_lookup(hg_mallocmeta_table, (UWord )p);
9829   md = (MallocMeta *)tmp;   9832   md = (MallocMeta *)tmp;
9830   if (md) {   9833   if (md) {
9831     tmp___0 = md->szB;   9834     tmp___0 = md->szB;
9832   } else {   9835   } else {
9833     tmp___0 = (SizeT )0;   9836     tmp___0 = (SizeT )0;
9834   }   9837   }
9835   return (tmp___0);   9838   return (tmp___0);
9836 }   9839 }
9837 }   9840 }
9838 __inline static Bool addr_is_in_MM_Chunk(MallocMeta *mm , Addr a )   9841 __inline static Bool addr_is_in_MM_Chunk(MallocMeta *mm , Addr a )
9839 {   9842 {
9840   int tmp ;   9843   int tmp ;
9841   long tmp___0 ;   9844   long tmp___0 ;
9842   long tmp___1 ;   9845   long tmp___1 ;
9843   long tmp___2 ;   9846   long tmp___2 ;
9844     9847  
9845   {   9848   {
9846   if (mm->szB == 0UL) {   9849   if (mm->szB == 0UL) {
9847     if (a == mm->payload) {   9850     if (a == mm->payload) {
9848       tmp = 1;   9851       tmp = 1;
9849     } else {   9852     } else {
9850       tmp = 0;   9853       tmp = 0;
9851     }   9854     }
9852   } else {   9855   } else {
9853     tmp = 0;   9856     tmp = 0;
9854   }   9857   }
9855   tmp___0 = __builtin_expect((long )tmp, 0L);   9858   tmp___0 = __builtin_expect((long )tmp, 0L);
9856   if (tmp___0) {   9859   if (tmp___0) {
9857     return ((Bool )1);   9860     return ((Bool )1);
9858   } else {   9861   } else {
9859     9862  
9860   }   9863   }
9861   tmp___1 = __builtin_expect((long )(! (! (a < mm->payload))), 1L);   9864   tmp___1 = __builtin_expect((long )(! (! (a < mm->payload))), 1L);
9862   if (tmp___1) {   9865   if (tmp___1) {
9863     return ((Bool )0);   9866     return ((Bool )0);
9864   } else {   9867   } else {
9865     9868  
9866   }   9869   }
9867   tmp___2 = __builtin_expect((long )(! (! (a >= mm->payload + mm->szB))), 1L);   9870   tmp___2 = __builtin_expect((long )(! (! (a >= mm->payload + mm->szB))), 1L);
9868   if (tmp___2) {   9871   if (tmp___2) {
9869     return ((Bool )0);   9872     return ((Bool )0);
9870   } else {   9873   } else {
9871     9874  
9872   }   9875   }
9873   return ((Bool )1);   9876   return ((Bool )1);
9874 }   9877 }
9875 }   9878 }
9876 Bool vgHelgrind_mm_find_containing_block(ExeContext **where , Addr *payload ,   9879 Bool vgHelgrind_mm_find_containing_block(ExeContext **where , Addr *payload ,
9877                                          SizeT *szB , Addr data_addr )   9880                                          SizeT *szB , Addr data_addr )
9878 {   9881 {
9879   MallocMeta *mm ;   9882   MallocMeta *mm ;
9880   Int i ;   9883   Int i ;
9881   Int n_fast_check_words ;   9884   Int n_fast_check_words ;
9882   void *tmp ;   9885   void *tmp ;
9883   Bool tmp___0 ;   9886   Bool tmp___0 ;
9884   int tmp___1 ;   9887   int tmp___1 ;
9885   long tmp___2 ;   9888   long tmp___2 ;
9886   Bool tmp___3 ;   9889   Bool tmp___3 ;
9887   long tmp___4 ;   9890   long tmp___4 ;
9888   void *tmp___5 ;   9891   void *tmp___5 ;
9889   Bool tmp___6 ;   9892   Bool tmp___6 ;
9890     9893  
9891   {   9894   {
9892   n_fast_check_words = 16;   9895   n_fast_check_words = 16;
9893   i = 0;   9896   i = 0;
9894   while (i < n_fast_check_words) {   9897   while (i < n_fast_check_words) {
9895     tmp = vgPlain_HT_lookup(hg_mallocmeta_table,   9898     tmp = vgPlain_HT_lookup(hg_mallocmeta_table,
9896                             data_addr - (UWord )((UInt )i) * (UWord )sizeof(UWord ));   9899                             data_addr - (UWord )((UInt )i) * (UWord )sizeof(UWord ));
9897     mm = (MallocMeta *)tmp;   9900     mm = (MallocMeta *)tmp;
9898     if (mm) {   9901     if (mm) {
9899       tmp___0 = addr_is_in_MM_Chunk(mm, data_addr);   9902       tmp___0 = addr_is_in_MM_Chunk(mm, data_addr);
9900       if (tmp___0) {   9903       if (tmp___0) {
9901         tmp___1 = 1;   9904         tmp___1 = 1;
9902       } else {   9905       } else {
9903         tmp___1 = 0;   9906         tmp___1 = 0;
9904       }   9907       }
9905     } else {   9908     } else {
9906       tmp___1 = 0;   9909       tmp___1 = 0;
9907     }   9910     }
9908     tmp___2 = __builtin_expect((long )tmp___1, 0L);   9911     tmp___2 = __builtin_expect((long )tmp___1, 0L);
9909     if (tmp___2) {   9912     if (tmp___2) {
9910       goto found;   9913       goto found;
9911     } else {   9914     } else {
9912     9915  
9913     }   9916     }
9914     i ++;   9917     i ++;
9915   }   9918   }
9916   vgPlain_HT_ResetIter(hg_mallocmeta_table);   9919   vgPlain_HT_ResetIter(hg_mallocmeta_table);
9917   while (1) {   9920   while (1) {
9918     tmp___5 = vgPlain_HT_Next(hg_mallocmeta_table);   9921     tmp___5 = vgPlain_HT_Next(hg_mallocmeta_table);
9919     mm = (MallocMeta *)tmp___5;   9922     mm = (MallocMeta *)tmp___5;
9920     if (mm) {   9923     if (mm) {
9921     9924  
9922     } else {   9925     } else {
9923       break;   9926       break;
9924     }   9927     }
9925     tmp___3 = addr_is_in_MM_Chunk(mm, data_addr);   9928     tmp___3 = addr_is_in_MM_Chunk(mm, data_addr);
9926     tmp___4 = __builtin_expect((long )tmp___3, 0L);   9929     tmp___4 = __builtin_expect((long )tmp___3, 0L);
9927     if (tmp___4) {   9930     if (tmp___4) {
9928       goto found;   9931       goto found;
9929     } else {   9932     } else {
9930     9933  
9931     }   9934     }
9932   }   9935   }
9933   return ((Bool )0);   9936   return ((Bool )0);
9934   found:   9937   found:
9935   if (mm) {   9938   if (mm) {
9936     9939  
9937   } else {   9940   } else {
9938     vgPlain_assert_fail((Bool )0, (Char const   *)"mm",   9941     vgPlain_assert_fail((Bool )0, (Char const   *)"mm",
9939                         (Char const   *)"hg_main.c", 3853,   9942                         (Char const   *)"hg_main.c", 3853,
9940                         (Char const   *)"vgHelgrind_mm_find_containing_block",   9943                         (Char const   *)"vgHelgrind_mm_find_containing_block",
9941                         "");   9944                         "");
9942   }   9945   }
9943   tmp___6 = addr_is_in_MM_Chunk(mm, data_addr);   9946   tmp___6 = addr_is_in_MM_Chunk(mm, data_addr);
9944   if (tmp___6) {   9947   if (tmp___6) {
9945     9948  
9946   } else {   9949   } else {
9947     vgPlain_assert_fail((Bool )0,   9950     vgPlain_assert_fail((Bool )0,
9948                         (Char const   *)"addr_is_in_MM_Chunk(mm, data_addr)",   9951                         (Char const   *)"addr_is_in_MM_Chunk(mm, data_addr)",
9949                         (Char const   *)"hg_main.c", 3854,   9952                         (Char const   *)"hg_main.c", 3854,
9950                         (Char const   *)"vgHelgrind_mm_find_containing_block",   9953                         (Char const   *)"vgHelgrind_mm_find_containing_block",
9951                         "");   9954                         "");
9952   }   9955   }
9953   if (where) {   9956   if (where) {
9954     *where = mm->where;   9957     *where = mm->where;
9955   } else {   9958   } else {
9956     9959  
9957   }   9960   }
9958   if (payload) {   9961   if (payload) {
9959     *payload = mm->payload;   9962     *payload = mm->payload;
9960   } else {   9963   } else {
9961     9964  
9962   }   9965   }
9963   if (szB) {   9966   if (szB) {
9964     *szB = mm->szB;   9967     *szB = mm->szB;
9965   } else {   9968   } else {
9966     9969  
9967   }   9970   }
9968   return ((Bool )1);   9971   return ((Bool )1);
9969 }   9972 }
9970 }   9973 }
9971 static void instrument_mem_access(IRSB *bbOut , IRExpr *addr , Int szB ,   9974 static void instrument_mem_access(IRSB *bbOut , IRExpr *addr , Int szB ,
9972                                   Bool isStore , Int hWordTy_szB )   9975                                   Bool isStore , Int hWordTy_szB )
9973 {   9976 {
9974   IRType tyAddr ;   9977   IRType tyAddr ;
9975   HChar *hName ;   9978   HChar *hName ;
9976   void *hAddr ;   9979   void *hAddr ;
9977   Int regparms ;   9980   Int regparms ;
9978   IRExpr **argv ;   9981   IRExpr **argv ;
9979   IRDirty *di ;   9982   IRDirty *di ;
9980   Bool tmp ;   9983   Bool tmp ;
9981   IRExpr *tmp___0 ;   9984   IRExpr *tmp___0 ;
9982   IRExpr *tmp___1 ;   9985   IRExpr *tmp___1 ;
9983   void *tmp___2 ;   9986   void *tmp___2 ;
9984   IRStmt *tmp___3 ;   9987   IRStmt *tmp___3 ;
9985     9988  
9986   {   9989   {
9987   tyAddr = (IRType )69632;   9990   tyAddr = (IRType )69632;
9988   hName = (HChar *)((void *)0);   9991   hName = (HChar *)((void *)0);
9989   hAddr = (void *)0;   9992   hAddr = (void *)0;
9990   regparms = 0;   9993   regparms = 0;
9991   argv = (IRExpr **)((void *)0);   9994   argv = (IRExpr **)((void *)0);
9992   di = (IRDirty *)((void *)0);   9995   di = (IRDirty *)((void *)0);
9993   tmp = isIRAtom(addr);   9996   tmp = isIRAtom(addr);
9994   if (tmp) {   9997   if (tmp) {
9995     9998  
9996   } else {   9999   } else {
9997     vgPlain_assert_fail((Bool )0, (Char const   *)"isIRAtom(addr)",   10000     vgPlain_assert_fail((Bool )0, (Char const   *)"isIRAtom(addr)",
9998                         (Char const   *)"hg_main.c", 3879,   10001                         (Char const   *)"hg_main.c", 3879,
9999                         (Char const   *)"instrument_mem_access", "");   10002                         (Char const   *)"instrument_mem_access", "");
10000   }   10003   }
10001   if (hWordTy_szB == 4) {   10004   if (hWordTy_szB == 4) {
10002     10005  
10003   } else   10006   } else
10004   if (hWordTy_szB == 8) {   10007   if (hWordTy_szB == 8) {
10005     10008  
10006   } else {   10009   } else {
10007     vgPlain_assert_fail((Bool )0,   10010     vgPlain_assert_fail((Bool )0,
10008                         (Char const   *)"hWordTy_szB == 4 || hWordTy_szB == 8",   10011                         (Char const   *)"hWordTy_szB == 4 || hWordTy_szB == 8",
10009                         (Char const   *)"hg_main.c", 3880,   10012                         (Char const   *)"hg_main.c", 3880,
10010                         (Char const   *)"instrument_mem_access", "");   10013                         (Char const   *)"instrument_mem_access", "");
10011   }   10014   }
10012   tyAddr = typeOfIRExpr(bbOut->tyenv, addr);   10015   tyAddr = typeOfIRExpr(bbOut->tyenv, addr);
10013   if ((unsigned int )tyAddr == 69636U) {   10016   if ((unsigned int )tyAddr == 69636U) {
10014     10017  
10015   } else   10018   } else
10016   if ((unsigned int )tyAddr == 69637U) {   10019   if ((unsigned int )tyAddr == 69637U) {
10017     10020  
10018   } else {   10021   } else {
10019     vgPlain_assert_fail((Bool )0,   10022     vgPlain_assert_fail((Bool )0,
10020                         (Char const   *)"tyAddr == Ity_I32 || tyAddr == Ity_I64",   10023                         (Char const   *)"tyAddr == Ity_I32 || tyAddr == Ity_I64",
10021                         (Char const   *)"hg_main.c", 3883,   10024                         (Char const   *)"hg_main.c", 3883,
10022                         (Char const   *)"instrument_mem_access", "");   10025                         (Char const   *)"instrument_mem_access", "");
10023   }   10026   }
10024   regparms = 1;   10027   regparms = 1;
10025   if (isStore) {   10028   if (isStore) {
10026     switch (szB) {   10029     switch (szB) {
10027     case 1:   10030     case 1:
10028     hName = (HChar *)"evh__mem_help_cwrite_1";   10031     hName = (HChar *)"evh__mem_help_cwrite_1";
10029     hAddr = (void *)(& evh__mem_help_cwrite_1);   10032     hAddr = (void *)(& evh__mem_help_cwrite_1);
10030     argv = mkIRExprVec_1(addr);   10033     argv = mkIRExprVec_1(addr);
10031     break;   10034     break;
10032     case 2:   10035     case 2:
10033     hName = (HChar *)"evh__mem_help_cwrite_2";   10036     hName = (HChar *)"evh__mem_help_cwrite_2";
10034     hAddr = (void *)(& evh__mem_help_cwrite_2);   10037     hAddr = (void *)(& evh__mem_help_cwrite_2);
10035     argv = mkIRExprVec_1(addr);   10038     argv = mkIRExprVec_1(addr);
10036     break;   10039     break;
10037     case 4:   10040     case 4:
10038     hName = (HChar *)"evh__mem_help_cwrite_4";   10041     hName = (HChar *)"evh__mem_help_cwrite_4";
10039     hAddr = (void *)(& evh__mem_help_cwrite_4);   10042     hAddr = (void *)(& evh__mem_help_cwrite_4);
10040     argv = mkIRExprVec_1(addr);   10043     argv = mkIRExprVec_1(addr);
10041     break;   10044     break;
10042     case 8:   10045     case 8:
10043     hName = (HChar *)"evh__mem_help_cwrite_8";   10046     hName = (HChar *)"evh__mem_help_cwrite_8";
10044     hAddr = (void *)(& evh__mem_help_cwrite_8);   10047     hAddr = (void *)(& evh__mem_help_cwrite_8);
10045     argv = mkIRExprVec_1(addr);   10048     argv = mkIRExprVec_1(addr);
10046     break;   10049     break;
10047     default:   10050     default:
10048     if (szB > 8) {   10051     if (szB > 8) {
10049       if (szB <= 512) {   10052       if (szB <= 512) {
10050     10053  
10051       } else {   10054       } else {
10052         vgPlain_assert_fail((Bool )0, (Char const   *)"szB > 8 && szB <= 512",   10055         vgPlain_assert_fail((Bool )0, (Char const   *)"szB > 8 && szB <= 512",
10053                             (Char const   *)"hg_main.c", 3910,   10056                             (Char const   *)"hg_main.c", 3910,
10054                             (Char const   *)"instrument_mem_access", "");   10057                             (Char const   *)"instrument_mem_access", "");
10055       }   10058       }
10056     } else {   10059     } else {
10057       vgPlain_assert_fail((Bool )0, (Char const   *)"szB > 8 && szB <= 512",   10060       vgPlain_assert_fail((Bool )0, (Char const   *)"szB > 8 && szB <= 512",
10058                           (Char const   *)"hg_main.c", 3910,   10061                           (Char const   *)"hg_main.c", 3910,
10059                           (Char const   *)"instrument_mem_access", "");   10062                           (Char const   *)"instrument_mem_access", "");
10060     }   10063     }
10061     regparms = 2;   10064     regparms = 2;
10062     hName = (HChar *)"evh__mem_help_cwrite_N";   10065     hName = (HChar *)"evh__mem_help_cwrite_N";
10063     hAddr = (void *)(& evh__mem_help_cwrite_N);   10066     hAddr = (void *)(& evh__mem_help_cwrite_N);
10064     tmp___0 = mkIRExpr_HWord((HWord )szB);   10067     tmp___0 = mkIRExpr_HWord((HWord )szB);
10065     argv = mkIRExprVec_2(addr, tmp___0);   10068     argv = mkIRExprVec_2(addr, tmp___0);
10066     break;   10069     break;
10067     }   10070     }
10068   } else {   10071   } else {
10069     switch (szB) {   10072     switch (szB) {
10070     case 1:   10073     case 1:
10071     hName = (HChar *)"evh__mem_help_cread_1";   10074     hName = (HChar *)"evh__mem_help_cread_1";
10072     hAddr = (void *)(& evh__mem_help_cread_1);   10075     hAddr = (void *)(& evh__mem_help_cread_1);
10073     argv = mkIRExprVec_1(addr);   10076     argv = mkIRExprVec_1(addr);
10074     break;   10077     break;
10075     case 2:   10078     case 2:
10076     hName = (HChar *)"evh__mem_help_cread_2";   10079     hName = (HChar *)"evh__mem_help_cread_2";
10077     hAddr = (void *)(& evh__mem_help_cread_2);   10080     hAddr = (void *)(& evh__mem_help_cread_2);
10078     argv = mkIRExprVec_1(addr);   10081     argv = mkIRExprVec_1(addr);
10079     break;   10082     break;
10080     case 4:   10083     case 4:
10081     hName = (HChar *)"evh__mem_help_cread_4";   10084     hName = (HChar *)"evh__mem_help_cread_4";
10082     hAddr = (void *)(& evh__mem_help_cread_4);   10085     hAddr = (void *)(& evh__mem_help_cread_4);
10083     argv = mkIRExprVec_1(addr);   10086     argv = mkIRExprVec_1(addr);
10084     break;   10087     break;
10085     case 8:   10088     case 8:
10086     hName = (HChar *)"evh__mem_help_cread_8";   10089     hName = (HChar *)"evh__mem_help_cread_8";
10087     hAddr = (void *)(& evh__mem_help_cread_8);   10090     hAddr = (void *)(& evh__mem_help_cread_8);
10088     argv = mkIRExprVec_1(addr);   10091     argv = mkIRExprVec_1(addr);
10089     break;   10092     break;
10090     default:   10093     default:
10091     if (szB > 8) {   10094     if (szB > 8) {
10092       if (szB <= 512) {   10095       if (szB <= 512) {
10093     10096  
10094       } else {   10097       } else {
10095         vgPlain_assert_fail((Bool )0, (Char const   *)"szB > 8 && szB <= 512",   10098         vgPlain_assert_fail((Bool )0, (Char const   *)"szB > 8 && szB <= 512",
10096                             (Char const   *)"hg_main.c", 3940,   10099                             (Char const   *)"hg_main.c", 3940,
10097                             (Char const   *)"instrument_mem_access", "");   10100                             (Char const   *)"instrument_mem_access", "");
10098       }   10101       }
10099     } else {   10102     } else {
10100       vgPlain_assert_fail((Bool )0, (Char const   *)"szB > 8 && szB <= 512",   10103       vgPlain_assert_fail((Bool )0, (Char const   *)"szB > 8 && szB <= 512",
10101                           (Char const   *)"hg_main.c", 3940,   10104                           (Char const   *)"hg_main.c", 3940,
10102                           (Char const   *)"instrument_mem_access", "");   10105                           (Char const   *)"instrument_mem_access", "");
10103     }   10106     }
10104     regparms = 2;   10107     regparms = 2;
10105     hName = (HChar *)"evh__mem_help_cread_N";   10108     hName = (HChar *)"evh__mem_help_cread_N";
10106     hAddr = (void *)(& evh__mem_help_cread_N);   10109     hAddr = (void *)(& evh__mem_help_cread_N);
10107     tmp___1 = mkIRExpr_HWord((HWord )szB);   10110     tmp___1 = mkIRExpr_HWord((HWord )szB);
10108     argv = mkIRExprVec_2(addr, tmp___1);   10111     argv = mkIRExprVec_2(addr, tmp___1);
10109     break;   10112     break;
10110     }   10113     }
10111   }   10114   }
10112   if (hName) {   10115   if (hName) {
10113     10116  
10114   } else {   10117   } else {
10115     vgPlain_assert_fail((Bool )0, (Char const   *)"hName",   10118     vgPlain_assert_fail((Bool )0, (Char const   *)"hName",
10116                         (Char const   *)"hg_main.c", 3950,   10119                         (Char const   *)"hg_main.c", 3950,
10117                         (Char const   *)"instrument_mem_access", "");   10120                         (Char const   *)"instrument_mem_access", "");
10118   }   10121   }
10119   if (hAddr) {   10122   if (hAddr) {
10120     10123  
10121   } else {   10124   } else {
10122     vgPlain_assert_fail((Bool )0, (Char const   *)"hAddr",   10125     vgPlain_assert_fail((Bool )0, (Char const   *)"hAddr",
10123                         (Char const   *)"hg_main.c", 3951,   10126                         (Char const   *)"hg_main.c", 3951,
10124                         (Char const   *)"instrument_mem_access", "");   10127                         (Char const   *)"instrument_mem_access", "");
10125   }   10128   }
10126   if (argv) {   10129   if (argv) {
10127     10130  
10128   } else {   10131   } else {
10129     vgPlain_assert_fail((Bool )0, (Char const   *)"argv",   10132     vgPlain_assert_fail((Bool )0, (Char const   *)"argv",
10130                         (Char const   *)"hg_main.c", 3952,   10133                         (Char const   *)"hg_main.c", 3952,
10131                         (Char const   *)"instrument_mem_access", "");   10134                         (Char const   *)"instrument_mem_access", "");
10132   }   10135   }
10133   tmp___2 = vgPlain_fnptr_to_fnentry(hAddr);   10136   tmp___2 = vgPlain_fnptr_to_fnentry(hAddr);
10134   di = unsafeIRDirty_0_N(regparms, hName, tmp___2, argv);   10137   di = unsafeIRDirty_0_N(regparms, hName, tmp___2, argv);
10135   tmp___3 = IRStmt_Dirty(di);   10138   tmp___3 = IRStmt_Dirty(di);
10136   addStmtToIRSB(bbOut, tmp___3);   10139   addStmtToIRSB(bbOut, tmp___3);
10137   return;   10140   return;
10138 }   10141 }
10139 }   10142 }
10140 static Bool is_in_dynamic_linker_shared_object(Addr64 ga )   10143 static Bool is_in_dynamic_linker_shared_object(Addr64 ga )
10141 {   10144 {
10142   DebugInfo *dinfo ;   10145   DebugInfo *dinfo ;
10143   UChar const   *soname ;   10146   UChar const   *soname ;
10144   Int tmp ;   10147   Int tmp ;
10145   int tmp___0 ;   10148   int tmp___0 ;
10146   Int tmp___1 ;   10149   Int tmp___1 ;
10147   Int tmp___2 ;   10150   Int tmp___2 ;
10148   int tmp___3 ;   10151   int tmp___3 ;
10149   Int tmp___4 ;   10152   Int tmp___4 ;
10150   Int tmp___5 ;   10153   Int tmp___5 ;
10151   int tmp___6 ;   10154   int tmp___6 ;
10152   Int tmp___7 ;   10155   Int tmp___7 ;
10153   Int tmp___8 ;   10156   Int tmp___8 ;
10154   int tmp___9 ;   10157   int tmp___9 ;
10155   Int tmp___10 ;   10158   Int tmp___10 ;
10156   Int tmp___11 ;   10159   Int tmp___11 ;
10157   int tmp___12 ;   10160   int tmp___12 ;
10158   Int tmp___13 ;   10161   Int tmp___13 ;
10159     10162  
10160   {   10163   {
10161   dinfo = vgPlain_find_DebugInfo((Addr )ga);   10164   dinfo = vgPlain_find_DebugInfo((Addr )ga);
10162   if (! dinfo) {   10165   if (! dinfo) {
10163     return ((Bool )0);   10166     return ((Bool )0);
10164   } else {   10167   } else {
10165     10168  
10166   }   10169   }
10167   soname = vgPlain_DebugInfo_get_soname((DebugInfo const   *)dinfo);   10170   soname = vgPlain_DebugInfo_get_soname((DebugInfo const   *)dinfo);
10168   if (soname) {   10171   if (soname) {
10169     10172  
10170   } else {   10173   } else {
10171     vgPlain_assert_fail((Bool )0, (Char const   *)"soname",   10174     vgPlain_assert_fail((Bool )0, (Char const   *)"soname",
10172                         (Char const   *)"hg_main.c", 3973,   10175                         (Char const   *)"hg_main.c", 3973,
10173                         (Char const   *)"is_in_dynamic_linker_shared_object", "");   10176                         (Char const   *)"is_in_dynamic_linker_shared_object", "");
10174   }   10177   }
10175   if ((unsigned int )soname != (unsigned int )((void *)0)) {   10178   if ((unsigned int )soname != (unsigned int )((void *)0)) {
10176     if ((unsigned int )"ld-linux.so.3" != (unsigned int )((void *)0)) {   10179     if ((unsigned int )"ld-linux.so.3" != (unsigned int )((void *)0)) {
10177       tmp___1 = vgPlain_strcmp((Char const   *)soname,   10180       tmp___1 = vgPlain_strcmp((Char const   *)soname,
10178                                (Char const   *)"ld-linux.so.3");   10181                                (Char const   *)"ld-linux.so.3");
10179       if (tmp___1 == 0) {   10182       if (tmp___1 == 0) {
10180         tmp___0 = (int )((Bool )1);   10183         tmp___0 = (int )((Bool )1);
10181       } else {   10184       } else {
10182         tmp___0 = (int )((Bool )0);   10185         tmp___0 = (int )((Bool )0);
10183       }   10186       }
10184     } else {   10187     } else {
10185       tmp___0 = (int )((Bool )0);   10188       tmp___0 = (int )((Bool )0);
10186     }   10189     }
10187   } else {   10190   } else {
10188     tmp___0 = (int )((Bool )0);   10191     tmp___0 = (int )((Bool )0);
10189   }   10192   }
10190   if (tmp___0) {   10193   if (tmp___0) {
10191     return ((Bool )1);   10194     return ((Bool )1);
10192   } else {   10195   } else {
10193     10196  
10194   }   10197   }
10195   if ((unsigned int )soname != (unsigned int )((void *)0)) {   10198   if ((unsigned int )soname != (unsigned int )((void *)0)) {
10196     if ((unsigned int )"ld-linux.so.2" != (unsigned int )((void *)0)) {   10199     if ((unsigned int )"ld-linux.so.2" != (unsigned int )((void *)0)) {
10197       tmp___4 = vgPlain_strcmp((Char const   *)soname,   10200       tmp___4 = vgPlain_strcmp((Char const   *)soname,
10198                                (Char const   *)"ld-linux.so.2");   10201                                (Char const   *)"ld-linux.so.2");
10199       if (tmp___4 == 0) {   10202       if (tmp___4 == 0) {
10200         tmp___3 = (int )((Bool )1);   10203         tmp___3 = (int )((Bool )1);
10201       } else {   10204       } else {
10202         tmp___3 = (int )((Bool )0);   10205         tmp___3 = (int )((Bool )0);
10203       }   10206       }
10204     } else {   10207     } else {
10205       tmp___3 = (int )((Bool )0);   10208       tmp___3 = (int )((Bool )0);
10206     }   10209     }
10207   } else {   10210   } else {
10208     tmp___3 = (int )((Bool )0);   10211     tmp___3 = (int )((Bool )0);
10209   }   10212   }
10210   if (tmp___3) {   10213   if (tmp___3) {
10211     return ((Bool )1);   10214     return ((Bool )1);
10212   } else {   10215   } else {
10213     10216  
10214   }   10217   }
10215   if ((unsigned int )soname != (unsigned int )((void *)0)) {   10218   if ((unsigned int )soname != (unsigned int )((void *)0)) {
10216     if ((unsigned int )"ld-linux-x86-64.so.2" != (unsigned int )((void *)0)) {   10219     if ((unsigned int )"ld-linux-x86-64.so.2" != (unsigned int )((void *)0)) {
10217       tmp___7 = vgPlain_strcmp((Char const   *)soname,   10220       tmp___7 = vgPlain_strcmp((Char const   *)soname,
10218                                (Char const   *)"ld-linux-x86-64.so.2");   10221                                (Char const   *)"ld-linux-x86-64.so.2");
10219       if (tmp___7 == 0) {   10222       if (tmp___7 == 0) {
10220         tmp___6 = (int )((Bool )1);   10223         tmp___6 = (int )((Bool )1);
10221       } else {   10224       } else {
10222         tmp___6 = (int )((Bool )0);   10225         tmp___6 = (int )((Bool )0);
10223       }   10226       }
10224     } else {   10227     } else {
10225       tmp___6 = (int )((Bool )0);   10228       tmp___6 = (int )((Bool )0);
10226     }   10229     }
10227   } else {   10230   } else {
10228     tmp___6 = (int )((Bool )0);   10231     tmp___6 = (int )((Bool )0);
10229   }   10232   }
10230   if (tmp___6) {   10233   if (tmp___6) {
10231     return ((Bool )1);   10234     return ((Bool )1);
10232   } else {   10235   } else {
10233     10236  
10234   }   10237   }
10235   if ((unsigned int )soname != (unsigned int )((void *)0)) {   10238   if ((unsigned int )soname != (unsigned int )((void *)0)) {
10236     if ((unsigned int )"ld64.so.1" != (unsigned int )((void *)0)) {   10239     if ((unsigned int )"ld64.so.1" != (unsigned int )((void *)0)) {
10237       tmp___10 = vgPlain_strcmp((Char const   *)soname,   10240       tmp___10 = vgPlain_strcmp((Char const   *)soname,
10238                                 (Char const   *)"ld64.so.1");   10241                                 (Char const   *)"ld64.so.1");
10239       if (tmp___10 == 0) {   10242       if (tmp___10 == 0) {
10240         tmp___9 = (int )((Bool )1);   10243         tmp___9 = (int )((Bool )1);
10241       } else {   10244       } else {
10242         tmp___9 = (int )((Bool )0);   10245         tmp___9 = (int )((Bool )0);
10243       }   10246       }
10244     } else {   10247     } else {
10245       tmp___9 = (int )((Bool )0);   10248       tmp___9 = (int )((Bool )0);
10246     }   10249     }
10247   } else {   10250   } else {
10248     tmp___9 = (int )((Bool )0);   10251     tmp___9 = (int )((Bool )0);
10249   }   10252   }
10250   if (tmp___9) {   10253   if (tmp___9) {
10251     return ((Bool )1);   10254     return ((Bool )1);
10252   } else {   10255   } else {
10253     10256  
10254   }   10257   }
10255   if ((unsigned int )soname != (unsigned int )((void *)0)) {   10258   if ((unsigned int )soname != (unsigned int )((void *)0)) {
10256     if ((unsigned int )"ld.so.1" != (unsigned int )((void *)0)) {   10259     if ((unsigned int )"ld.so.1" != (unsigned int )((void *)0)) {
10257       tmp___13 = vgPlain_strcmp((Char const   *)soname,   10260       tmp___13 = vgPlain_strcmp((Char const   *)soname,
10258                                 (Char const   *)"ld.so.1");   10261                                 (Char const   *)"ld.so.1");
10259       if (tmp___13 == 0) {   10262       if (tmp___13 == 0) {
10260         tmp___12 = (int )((Bool )1);   10263         tmp___12 = (int )((Bool )1);
10261       } else {   10264       } else {
10262         tmp___12 = (int )((Bool )0);   10265         tmp___12 = (int )((Bool )0);
10263       }   10266       }
10264     } else {   10267     } else {
10265       tmp___12 = (int )((Bool )0);   10268       tmp___12 = (int )((Bool )0);
10266     }   10269     }
10267   } else {   10270   } else {
10268     tmp___12 = (int )((Bool )0);   10271     tmp___12 = (int )((Bool )0);
10269   }   10272   }
10270   if (tmp___12) {   10273   if (tmp___12) {
10271     return ((Bool )1);   10274     return ((Bool )1);
10272   } else {   10275   } else {
10273     10276  
10274   }   10277   }
10275   return ((Bool )0);   10278   return ((Bool )0);
10276 }   10279 }
10277 }   10280 }
10278 static IRSB *hg_instrument(VgCallbackClosure *closure , IRSB *bbIn ,   10281 static IRSB *hg_instrument(VgCallbackClosure *closure , IRSB *bbIn ,
10279                            VexGuestLayout *layout , VexGuestExtents *vge ,   10282                            VexGuestLayout *layout , VexGuestExtents *vge ,
10280                            IRType gWordTy , IRType hWordTy )   10283                            IRType gWordTy , IRType hWordTy )
10281 {   10284 {
10282   Int i ;   10285   Int i ;
10283   IRSB *bbOut ;   10286   IRSB *bbOut ;
10284   Addr64 cia ;   10287   Addr64 cia ;
10285   IRStmt *st ;   10288   IRStmt *st ;
10286   Bool inLDSO ;   10289   Bool inLDSO ;
10287   Addr64 inLDSOmask4K ;   10290   Addr64 inLDSOmask4K ;
10288   Int tmp ;   10291   Int tmp ;
10289   Bool tmp___0 ;   10292   Bool tmp___0 ;
10290   IRCAS *cas ;   10293   IRCAS *cas ;
10291   Bool isDCAS ;   10294   Bool isDCAS ;
10292   Int tmp___1 ;   10295   Int tmp___1 ;
10293   int tmp___2 ;   10296   int tmp___2 ;
10294   IRType tmp___3 ;   10297   IRType tmp___3 ;
10295   Int tmp___4 ;   10298   Int tmp___4 ;
10296   IRType dataTy ;   10299   IRType dataTy ;
10297   Int tmp___5 ;   10300   Int tmp___5 ;
10298   Int tmp___6 ;   10301   Int tmp___6 ;
10299   Int tmp___7 ;   10302   Int tmp___7 ;
10300   IRType tmp___8 ;   10303   IRType tmp___8 ;
10301   Int tmp___9 ;   10304   Int tmp___9 ;
10302   IRExpr *data ;   10305   IRExpr *data ;
10303   Int tmp___10 ;   10306   Int tmp___10 ;
10304   Int tmp___11 ;   10307   Int tmp___11 ;
10305   Int dataSize ;   10308   Int dataSize ;
10306   IRDirty *d ;   10309   IRDirty *d ;
10307   Int tmp___12 ;   10310   Int tmp___12 ;
10308   Int tmp___13 ;   10311   Int tmp___13 ;
10309     10312  
10310   {   10313   {
10311   inLDSO = (Bool )0;   10314   inLDSO = (Bool )0;
10312   inLDSOmask4K = (Addr64 )1;   10315   inLDSOmask4K = (Addr64 )1;
10313   if ((unsigned int )gWordTy != (unsigned int )hWordTy) {   10316   if ((unsigned int )gWordTy != (unsigned int )hWordTy) {
10314     vgPlain_tool_panic((Char *)"host/guest word size mismatch");   10317     vgPlain_tool_panic((Char *)"host/guest word size mismatch");
10315   } else {   10318   } else {
10316     10319  
10317   }   10320   }
10318   if (1UL << 12 < 4096UL) {   10321   if (1UL << 12 < 4096UL) {
10319     vgPlain_tool_panic((Char *)"implausible or too-small VKI_PAGE_SIZE");   10322     vgPlain_tool_panic((Char *)"implausible or too-small VKI_PAGE_SIZE");
10320   } else {   10323   } else {
10321     tmp = vgPlain_log2((UInt )(1UL << 12));   10324     tmp = vgPlain_log2((UInt )(1UL << 12));
10322     if (tmp == -1) {   10325     if (tmp == -1) {
10323       vgPlain_tool_panic((Char *)"implausible or too-small VKI_PAGE_SIZE");   10326       vgPlain_tool_panic((Char *)"implausible or too-small VKI_PAGE_SIZE");
10324     } else {   10327     } else {
10325     10328  
10326     }   10329     }
10327   }   10330   }
10328   bbOut = emptyIRSB();   10331   bbOut = emptyIRSB();
10329   bbOut->tyenv = deepCopyIRTypeEnv(bbIn->tyenv);   10332   bbOut->tyenv = deepCopyIRTypeEnv(bbIn->tyenv);
10330   bbOut->next = deepCopyIRExpr(bbIn->next);   10333   bbOut->next = deepCopyIRExpr(bbIn->next);
10331   bbOut->jumpkind = bbIn->jumpkind;   10334   bbOut->jumpkind = bbIn->jumpkind;
10332   i = 0;   10335   i = 0;
10333   while (1) {   10336   while (1) {
10334     if (i < bbIn->stmts_used) {   10337     if (i < bbIn->stmts_used) {
10335       if ((unsigned int )(*(bbIn->stmts + i))->tag != 102401U) {   10338       if ((unsigned int )(*(bbIn->stmts + i))->tag != 102401U) {
10336     10339  
10337       } else {   10340       } else {
10338         break;   10341         break;
10339       }   10342       }
10340     } else {   10343     } else {
10341       break;   10344       break;
10342     }   10345     }
10343     addStmtToIRSB(bbOut, *(bbIn->stmts + i));   10346     addStmtToIRSB(bbOut, *(bbIn->stmts + i));
10344     i ++;   10347     i ++;
10345   }   10348   }
10346   if (bbIn->stmts_used > 0) {   10349   if (bbIn->stmts_used > 0) {
10347     10350  
10348   } else {   10351   } else {
10349     vgPlain_assert_fail((Bool )0, (Char const   *)"bbIn->stmts_used > 0",   10352     vgPlain_assert_fail((Bool )0, (Char const   *)"bbIn->stmts_used > 0",
10350                         (Char const   *)"hg_main.c", 4027,   10353                         (Char const   *)"hg_main.c", 4027,
10351                         (Char const   *)"hg_instrument", "");   10354                         (Char const   *)"hg_instrument", "");
10352   }   10355   }
10353   if (i < bbIn->stmts_used) {   10356   if (i < bbIn->stmts_used) {
10354     10357  
10355   } else {   10358   } else {
10356     vgPlain_assert_fail((Bool )0, (Char const   *)"i < bbIn->stmts_used",   10359     vgPlain_assert_fail((Bool )0, (Char const   *)"i < bbIn->stmts_used",
10357                         (Char const   *)"hg_main.c", 4028,   10360                         (Char const   *)"hg_main.c", 4028,
10358                         (Char const   *)"hg_instrument", "");   10361                         (Char const   *)"hg_instrument", "");
10359   }   10362   }
10360   st = *(bbIn->stmts + i);   10363   st = *(bbIn->stmts + i);
10361   if (102401U == (unsigned int )st->tag) {   10364   if (102401U == (unsigned int )st->tag) {
10362     10365  
10363   } else {   10366   } else {
10364     vgPlain_assert_fail((Bool )0, (Char const   *)"Ist_IMark == st->tag",   10367     vgPlain_assert_fail((Bool )0, (Char const   *)"Ist_IMark == st->tag",
10365                         (Char const   *)"hg_main.c", 4030,   10368                         (Char const   *)"hg_main.c", 4030,
10366                         (Char const   *)"hg_instrument", "");   10369                         (Char const   *)"hg_instrument", "");
10367   }   10370   }
10368   cia = st->Ist.IMark.addr;   10371   cia = st->Ist.IMark.addr;
10369   st = (IRStmt *)((void *)0);   10372   st = (IRStmt *)((void *)0);
10370   while (i < bbIn->stmts_used) {   10373   while (i < bbIn->stmts_used) {
10371     st = *(bbIn->stmts + i);   10374     st = *(bbIn->stmts + i);
10372     if (st) {   10375     if (st) {
10373     10376  
10374     } else {   10377     } else {
10375       vgPlain_assert_fail((Bool )0, (Char const   *)"st",   10378       vgPlain_assert_fail((Bool )0, (Char const   *)"st",
10376                           (Char const   *)"hg_main.c", 4036,   10379                           (Char const   *)"hg_main.c", 4036,
10377                           (Char const   *)"hg_instrument", "");   10380                           (Char const   *)"hg_instrument", "");
10378     }   10381     }
10379     tmp___0 = isFlatIRStmt(st);   10382     tmp___0 = isFlatIRStmt(st);
10380     if (tmp___0) {   10383     if (tmp___0) {
10381     10384  
10382     } else {   10385     } else {
10383       vgPlain_assert_fail((Bool )0, (Char const   *)"isFlatIRStmt(st)",   10386       vgPlain_assert_fail((Bool )0, (Char const   *)"isFlatIRStmt(st)",
10384                           (Char const   *)"hg_main.c", 4037,   10387                           (Char const   *)"hg_main.c", 4037,
10385                           (Char const   *)"hg_instrument", "");   10388                           (Char const   *)"hg_instrument", "");
10386     }   10389     }
10387     switch ((unsigned int )st->tag) {   10390     switch ((unsigned int )st->tag) {
10388     case 102411U:   10391     case 102411U:
10389     case 102404U:   10392     case 102404U:
10390     case 102403U:   10393     case 102403U:
10391     case 102402U:   10394     case 102402U:
10392     case 102400U:   10395     case 102400U:
10393     break;   10396     break;
10394     case 102401U:   10397     case 102401U:
10395     cia = st->Ist.IMark.addr;   10398     cia = st->Ist.IMark.addr;
10396     if ((cia & 0xfffffffffffff000ULL) != inLDSOmask4K) {   10399     if ((cia & 0xfffffffffffff000ULL) != inLDSOmask4K) {
10397       inLDSOmask4K = cia & 0xfffffffffffff000ULL;   10400       inLDSOmask4K = cia & 0xfffffffffffff000ULL;
10398       inLDSO = is_in_dynamic_linker_shared_object(cia);   10401       inLDSO = is_in_dynamic_linker_shared_object(cia);
10399     } else {   10402     } else {
10400     10403  
10401     }   10404     }
10402     break;   10405     break;
10403     case 102410U:   10406     case 102410U:
10404     switch ((unsigned int )st->Ist.MBE.event) {   10407     switch ((unsigned int )st->Ist.MBE.event) {
10405     case 98304U:   10408     case 98304U:
10406     break;   10409     break;
10407     default:   10410     default:
10408     goto unhandled;   10411     goto unhandled;
10409     }   10412     }
10410     break;   10413     break;
10411     case 102407U:   10414     case 102407U:
10412     cas = st->Ist.CAS.details;   10415     cas = st->Ist.CAS.details;
10413     isDCAS = (Bool )(cas->oldHi != 4294967295U);   10416     isDCAS = (Bool )(cas->oldHi != 4294967295U);
10414     if (isDCAS) {   10417     if (isDCAS) {
10415       if (cas->expdHi) {   10418       if (cas->expdHi) {
10416     10419  
10417       } else {   10420       } else {
10418         vgPlain_assert_fail((Bool )0, (Char const   *)"cas->expdHi",   10421         vgPlain_assert_fail((Bool )0, (Char const   *)"cas->expdHi",
10419                             (Char const   *)"hg_main.c", 4081,   10422                             (Char const   *)"hg_main.c", 4081,
10420                             (Char const   *)"hg_instrument", "");   10423                             (Char const   *)"hg_instrument", "");
10421       }   10424       }
10422       if (cas->dataHi) {   10425       if (cas->dataHi) {
10423     10426  
10424       } else {   10427       } else {
10425         vgPlain_assert_fail((Bool )0, (Char const   *)"cas->dataHi",   10428         vgPlain_assert_fail((Bool )0, (Char const   *)"cas->dataHi",
10426                             (Char const   *)"hg_main.c", 4082,   10429                             (Char const   *)"hg_main.c", 4082,
10427                             (Char const   *)"hg_instrument", "");   10430                             (Char const   *)"hg_instrument", "");
10428       }   10431       }
10429     } else {   10432     } else {
10430       if (! cas->expdHi) {   10433       if (! cas->expdHi) {
10431     10434  
10432       } else {   10435       } else {
10433         vgPlain_assert_fail((Bool )0, (Char const   *)"!cas->expdHi",   10436         vgPlain_assert_fail((Bool )0, (Char const   *)"!cas->expdHi",
10434                             (Char const   *)"hg_main.c", 4084,   10437                             (Char const   *)"hg_main.c", 4084,
10435                             (Char const   *)"hg_instrument", "");   10438                             (Char const   *)"hg_instrument", "");
10436       }   10439       }
10437       if (! cas->dataHi) {   10440       if (! cas->dataHi) {
10438     10441  
10439       } else {   10442       } else {
10440         vgPlain_assert_fail((Bool )0, (Char const   *)"!cas->dataHi",   10443         vgPlain_assert_fail((Bool )0, (Char const   *)"!cas->dataHi",
10441                             (Char const   *)"hg_main.c", 4085,   10444                             (Char const   *)"hg_main.c", 4085,
10442                             (Char const   *)"hg_instrument", "");   10445                             (Char const   *)"hg_instrument", "");
10443       }   10446       }
10444     }   10447     }
10445     if (! inLDSO) {   10448     if (! inLDSO) {
10446       tmp___1 = sizeofIRType(hWordTy);   10449       tmp___1 = sizeofIRType(hWordTy);
10447       if (isDCAS) {   10450       if (isDCAS) {
10448         tmp___2 = 2;   10451         tmp___2 = 2;
10449       } else {   10452       } else {
10450         tmp___2 = 1;   10453         tmp___2 = 1;
10451       }   10454       }
10452       tmp___3 = typeOfIRExpr(bbIn->tyenv, cas->dataLo);   10455       tmp___3 = typeOfIRExpr(bbIn->tyenv, cas->dataLo);
10453       tmp___4 = sizeofIRType(tmp___3);   10456       tmp___4 = sizeofIRType(tmp___3);
10454       instrument_mem_access(bbOut, cas->addr, tmp___2 * tmp___4, (Bool )0,   10457       instrument_mem_access(bbOut, cas->addr, tmp___2 * tmp___4, (Bool )0,
10455                             tmp___1);   10458                             tmp___1);
10456     } else {   10459     } else {
10457     10460  
10458     }   10461     }
10459     break;   10462     break;
10460     case 102408U:   10463     case 102408U:
10461     if ((unsigned int )st->Ist.LLSC.storedata == (unsigned int )((void *)0)) {   10464     if ((unsigned int )st->Ist.LLSC.storedata == (unsigned int )((void *)0)) {
10462       dataTy = typeOfIRTemp(bbIn->tyenv, st->Ist.LLSC.result);   10465       dataTy = typeOfIRTemp(bbIn->tyenv, st->Ist.LLSC.result);
10463       if (! inLDSO) {   10466       if (! inLDSO) {
10464         tmp___5 = sizeofIRType(hWordTy);   10467         tmp___5 = sizeofIRType(hWordTy);
10465         tmp___6 = sizeofIRType(dataTy);   10468         tmp___6 = sizeofIRType(dataTy);
10466         instrument_mem_access(bbOut, st->Ist.LLSC.addr, tmp___6, (Bool )0,   10469         instrument_mem_access(bbOut, st->Ist.LLSC.addr, tmp___6, (Bool )0,
10467                               tmp___5);   10470                               tmp___5);
10468       } else {   10471       } else {
10469     10472  
10470       }   10473       }
10471     } else {   10474     } else {
10472     10475  
10473     }   10476     }
10474     break;   10477     break;
10475     case 102406U:   10478     case 102406U:
10476     if (! inLDSO) {   10479     if (! inLDSO) {
10477       tmp___7 = sizeofIRType(hWordTy);   10480       tmp___7 = sizeofIRType(hWordTy);
10478       tmp___8 = typeOfIRExpr(bbIn->tyenv, st->Ist.Store.data);   10481       tmp___8 = typeOfIRExpr(bbIn->tyenv, st->Ist.Store.data);
10479       tmp___9 = sizeofIRType(tmp___8);   10482       tmp___9 = sizeofIRType(tmp___8);
10480       instrument_mem_access(bbOut, st->Ist.Store.addr, tmp___9, (Bool )1,   10483       instrument_mem_access(bbOut, st->Ist.Store.addr, tmp___9, (Bool )1,
10481                             tmp___7);   10484                             tmp___7);
10482     } else {   10485     } else {
10483     10486  
10484     }   10487     }
10485     break;   10488     break;
10486     case 102405U:   10489     case 102405U:
10487     data = st->Ist.WrTmp.data;   10490     data = st->Ist.WrTmp.data;
10488     if ((unsigned int )data->tag == 86024U) {   10491     if ((unsigned int )data->tag == 86024U) {
10489       if (! inLDSO) {   10492       if (! inLDSO) {
10490         tmp___10 = sizeofIRType(hWordTy);   10493         tmp___10 = sizeofIRType(hWordTy);
10491         tmp___11 = sizeofIRType(data->Iex.Load.ty);   10494         tmp___11 = sizeofIRType(data->Iex.Load.ty);
10492         instrument_mem_access(bbOut, data->Iex.Load.addr, tmp___11, (Bool )0,   10495         instrument_mem_access(bbOut, data->Iex.Load.addr, tmp___11, (Bool )0,
10493                               tmp___10);   10496                               tmp___10);
10494       } else {   10497       } else {
10495     10498  
10496       }   10499       }
10497     } else {   10500     } else {
10498     10501  
10499     }   10502     }
10500     break;   10503     break;
10501     case 102409U:   10504     case 102409U:
10502     d = st->Ist.Dirty.details;   10505     d = st->Ist.Dirty.details;
10503     if ((unsigned int )d->mFx != 94208U) {   10506     if ((unsigned int )d->mFx != 94208U) {
10504       if ((unsigned int )d->mAddr != (unsigned int )((void *)0)) {   10507       if ((unsigned int )d->mAddr != (unsigned int )((void *)0)) {
10505     10508  
10506       } else {   10509       } else {
10507         vgPlain_assert_fail((Bool )0, (Char const   *)"d->mAddr != NULL",   10510         vgPlain_assert_fail((Bool )0, (Char const   *)"d->mAddr != NULL",
10508                             (Char const   *)"hg_main.c", 4163,   10511                             (Char const   *)"hg_main.c", 4163,
10509                             (Char const   *)"hg_instrument", "");   10512                             (Char const   *)"hg_instrument", "");
10510       }   10513       }
10511       if (d->mSize != 0) {   10514       if (d->mSize != 0) {
10512     10515  
10513       } else {   10516       } else {
10514         vgPlain_assert_fail((Bool )0, (Char const   *)"d->mSize != 0",   10517         vgPlain_assert_fail((Bool )0, (Char const   *)"d->mSize != 0",
10515                             (Char const   *)"hg_main.c", 4164,   10518                             (Char const   *)"hg_main.c", 4164,
10516                             (Char const   *)"hg_instrument", "");   10519                             (Char const   *)"hg_instrument", "");
10517       }   10520       }
10518       dataSize = d->mSize;   10521       dataSize = d->mSize;
10519       if ((unsigned int )d->mFx == 94209U) {   10522       if ((unsigned int )d->mFx == 94209U) {
10520         goto _L;   10523         goto _L;
10521       } else   10524       } else
10522       if ((unsigned int )d->mFx == 94211U) {   10525       if ((unsigned int )d->mFx == 94211U) {
10523         _L: /* CIL Label */   10526         _L: /* CIL Label */
10524         if (! inLDSO) {   10527         if (! inLDSO) {
10525           tmp___12 = sizeofIRType(hWordTy);   10528           tmp___12 = sizeofIRType(hWordTy);
10526           instrument_mem_access(bbOut, d->mAddr, dataSize, (Bool )0, tmp___12);   10529           instrument_mem_access(bbOut, d->mAddr, dataSize, (Bool )0, tmp___12);
10527         } else {   10530         } else {
10528     10531  
10529         }   10532         }
10530       } else {   10533       } else {
10531     10534  
10532       }   10535       }
10533       if ((unsigned int )d->mFx == 94210U) {   10536       if ((unsigned int )d->mFx == 94210U) {
10534         goto _L___0;   10537         goto _L___0;
10535       } else   10538       } else
10536       if ((unsigned int )d->mFx == 94211U) {   10539       if ((unsigned int )d->mFx == 94211U) {
10537         _L___0: /* CIL Label */   10540         _L___0: /* CIL Label */
10538         if (! inLDSO) {   10541         if (! inLDSO) {
10539           tmp___13 = sizeofIRType(hWordTy);   10542           tmp___13 = sizeofIRType(hWordTy);
10540           instrument_mem_access(bbOut, d->mAddr, dataSize, (Bool )1, tmp___13);   10543           instrument_mem_access(bbOut, d->mAddr, dataSize, (Bool )1, tmp___13);
10541         } else {   10544         } else {
10542     10545  
10543         }   10546         }
10544       } else {   10547       } else {
10545     10548  
10546       }   10549       }
10547     } else {   10550     } else {
10548       if ((unsigned int )d->mAddr == (unsigned int )((void *)0)) {   10551       if ((unsigned int )d->mAddr == (unsigned int )((void *)0)) {
10549     10552  
10550       } else {   10553       } else {
10551         vgPlain_assert_fail((Bool )0, (Char const   *)"d->mAddr == NULL",   10554         vgPlain_assert_fail((Bool )0, (Char const   *)"d->mAddr == NULL",
10552                             (Char const   *)"hg_main.c", 4183,   10555                             (Char const   *)"hg_main.c", 4183,
10553                             (Char const   *)"hg_instrument", "");   10556                             (Char const   *)"hg_instrument", "");
10554       }   10557       }
10555       if (d->mSize == 0) {   10558       if (d->mSize == 0) {
10556     10559  
10557       } else {   10560       } else {
10558         vgPlain_assert_fail((Bool )0, (Char const   *)"d->mSize == 0",   10561         vgPlain_assert_fail((Bool )0, (Char const   *)"d->mSize == 0",
10559                             (Char const   *)"hg_main.c", 4184,   10562                             (Char const   *)"hg_main.c", 4184,
10560                             (Char const   *)"hg_instrument", "");   10563                             (Char const   *)"hg_instrument", "");
10561       }   10564       }
10562     }   10565     }
10563     break;   10566     break;
10564     unhandled:   10567     unhandled:
10565     default:   10568     default:
10566     ppIRStmt(st);   10569     ppIRStmt(st);
10567     vgPlain_assert_fail((Bool )0, (Char const   *)"0",   10570     vgPlain_assert_fail((Bool )0, (Char const   *)"0",
10568                         (Char const   *)"hg_main.c", 4192,   10571                         (Char const   *)"hg_main.c", 4192,
10569                         (Char const   *)"hg_instrument", "");   10572                         (Char const   *)"hg_instrument", "");
10570     }   10573     }
10571     addStmtToIRSB(bbOut, st);   10574     addStmtToIRSB(bbOut, st);
10572     i ++;   10575     i ++;
10573   }   10576   }
10574   return (bbOut);   10577   return (bbOut);
10575 }   10578 }
10576 }   10579 }
10577 static WordFM *map_pthread_t_to_Thread  =    (WordFM *)((void *)0);   10580 static WordFM *map_pthread_t_to_Thread  =    (WordFM *)((void *)0);
10578 static void map_pthread_t_to_Thread_INIT(void)   10581 static void map_pthread_t_to_Thread_INIT(void)
10579 {   10582 {
10580   long tmp ;   10583   long tmp ;
10581     10584  
10582   {   10585   {
10583   tmp = __builtin_expect((long )((unsigned int )map_pthread_t_to_Thread == (unsigned int )((void *)0)),   10586   tmp = __builtin_expect((long )((unsigned int )map_pthread_t_to_Thread == (unsigned int )((void *)0)),
10584                          0L);   10587                          0L);
10585   if (tmp) {   10588   if (tmp) {
10586     map_pthread_t_to_Thread = vgPlain_newFM(& vgHelgrind_zalloc,   10589     map_pthread_t_to_Thread = vgPlain_newFM(& vgHelgrind_zalloc,
10587                                             (HChar *)"hg.mpttT.1",   10590                                             (HChar *)"hg.mpttT.1",
10588                                             & vgHelgrind_free,   10591                                             & vgHelgrind_free,
10589                                             (Word (*)(UWord  , UWord  ))((void *)0));   10592                                             (Word (*)(UWord  , UWord  ))((void *)0));
10590     if ((unsigned int )map_pthread_t_to_Thread != (unsigned int )((void *)0)) {   10593     if ((unsigned int )map_pthread_t_to_Thread != (unsigned int )((void *)0)) {
10591     10594  
10592     } else {   10595     } else {
10593       vgPlain_assert_fail((Bool )0,   10596       vgPlain_assert_fail((Bool )0,
10594                           (Char const   *)"map_pthread_t_to_Thread != NULL",   10597                           (Char const   *)"map_pthread_t_to_Thread != NULL",
10595                           (Char const   *)"hg_main.c", 4214,   10598                           (Char const   *)"hg_main.c", 4214,
10596                           (Char const   *)"map_pthread_t_to_Thread_INIT", "");   10599                           (Char const   *)"map_pthread_t_to_Thread_INIT", "");
10597     }   10600     }
10598   } else {   10601   } else {
10599     10602  
10600   }   10603   }
10601   return;   10604   return;
10602 }   10605 }
10603 }   10606 }
10604 static Bool hg_handle_client_request(ThreadId tid , UWord *args , UWord *ret )   10607 static Bool hg_handle_client_request(ThreadId tid , UWord *args , UWord *ret )
10605 {   10608 {
10606   Addr payload ;   10609   Addr payload ;
10607   SizeT pszB ;   10610   SizeT pszB ;
10608   Bool tmp ;   10611   Bool tmp ;
10609   Thread *my_thr ;   10612   Thread *my_thr ;
10610   Thread *my_thr___0 ;   10613   Thread *my_thr___0 ;
10611   Thread *thr_q ;   10614   Thread *thr_q ;
10612   Bool found ;   10615   Bool found ;
10613   Bool mutex_is_valid ;   10616   Bool mutex_is_valid ;
10614   Bool tmp___0 ;   10617   Bool tmp___0 ;
10615   HChar *who ;   10618   HChar *who ;
10616   HChar buf[100] ;   10619   HChar buf[100] ;
10617   Thread *thr ;   10620   Thread *thr ;
10618   Thread *tmp___1 ;   10621   Thread *tmp___1 ;
10619   SizeT tmp___2 ;   10622   SizeT tmp___2 ;
10620     10623  
10621   {   10624   {
10622   if (! ((unsigned long )((unsigned int )((72 << 24) | (71 << 16))) == (*(args + 0) & 4294901760UL))) {   10625   if (! ((unsigned long )((unsigned int )((72 << 24) | (71 << 16))) == (*(args + 0) & 4294901760UL))) {
10623     return ((Bool )0);   10626     return ((Bool )0);
10624   } else {   10627   } else {
10625     10628  
10626   }   10629   }
10627   *ret = (UWord )0;   10630   *ret = (UWord )0;
10628   switch (*(args + 0)) {   10631   switch (*(args + 0)) {
10629   case 1212612608UL: ;   10632   case 1212612608UL: ;
10630   if (*(args + 2) > 0UL) {   10633   if (*(args + 2) > 0UL) {
10631     evh__die_mem(*(args + 1), *(args + 2));   10634     evh__die_mem(*(args + 1), *(args + 2));
10632     evh__new_mem(*(args + 1), *(args + 2));   10635     evh__new_mem(*(args + 1), *(args + 2));
10633   } else {   10636   } else {
10634     10637  
10635   }   10638   }
10636   break;   10639   break;
10637   case 1212612906UL:   10640   case 1212612906UL:
10638   payload = (Addr )0;   10641   payload = (Addr )0;
10639   pszB = (SizeT )0;   10642   pszB = (SizeT )0;
10640   tmp = vgHelgrind_mm_find_containing_block((ExeContext **)((void *)0),   10643   tmp = vgHelgrind_mm_find_containing_block((ExeContext **)((void *)0),
10641                                             & payload, & pszB, *(args + 1));   10644                                             & payload, & pszB, *(args + 1));
10642   if (tmp) {   10645   if (tmp) {
10643     if (pszB > 0UL) {   10646     if (pszB > 0UL) {
10644       evh__die_mem(payload, pszB);   10647       evh__die_mem(payload, pszB);
10645       evh__new_mem(payload, pszB);   10648       evh__new_mem(payload, pszB);
10646     } else {   10649     } else {
10647     10650  
10648     }   10651     }
10649     *ret = pszB;   10652     *ret = pszB;
10650   } else {   10653   } else {
10651     *ret = (UWord )-1;   10654     *ret = (UWord )-1;
10652   }   10655   }
10653   break;   10656   break;
10654   case 1212612903UL: ;   10657   case 1212612903UL: ;
10655   if (*(args + 2) > 0UL) {   10658   if (*(args + 2) > 0UL) {
10656     evh__untrack_mem(*(args + 1), *(args + 2));   10659     evh__untrack_mem(*(args + 1), *(args + 2));
10657   } else {   10660   } else {
10658     10661  
10659   }   10662   }
10660   break;   10663   break;
10661   case 1212612904UL: ;   10664   case 1212612904UL: ;
10662   if (*(args + 2) > 0UL) {   10665   if (*(args + 2) > 0UL) {
10663     evh__new_mem(*(args + 1), *(args + 2));   10666     evh__new_mem(*(args + 1), *(args + 2));
10664   } else {   10667   } else {
10665     10668  
10666   }   10669   }
10667   break;   10670   break;
10668   case 1212612864UL:   10671   case 1212612864UL:
10669   my_thr = (Thread *)((void *)0);   10672   my_thr = (Thread *)((void *)0);
10670   map_pthread_t_to_Thread_INIT();   10673   map_pthread_t_to_Thread_INIT();
10671   my_thr = map_threads_maybe_lookup(tid);   10674   my_thr = map_threads_maybe_lookup(tid);
10672   if ((unsigned int )my_thr != (unsigned int )((void *)0)) {   10675   if ((unsigned int )my_thr != (unsigned int )((void *)0)) {
10673     10676  
10674   } else {   10677   } else {
10675     vgPlain_assert_fail((Bool )0, (Char const   *)"my_thr != NULL",   10678     vgPlain_assert_fail((Bool )0, (Char const   *)"my_thr != NULL",
10676                         (Char const   *)"hg_main.c", 4302,   10679                         (Char const   *)"hg_main.c", 4302,
10677                         (Char const   *)"hg_handle_client_request", "");   10680                         (Char const   *)"hg_handle_client_request", "");
10678   }   10681   }
10679   vgPlain_addToFM(map_pthread_t_to_Thread, (UWord )((Word )*(args + 1)),   10682   vgPlain_addToFM(map_pthread_t_to_Thread, (UWord )((Word )*(args + 1)),
10680                   (UWord )((Word )my_thr));   10683                   (UWord )((Word )my_thr));
10681   break;   10684   break;
10682   case 1212612865UL:   10685   case 1212612865UL:
10683   my_thr___0 = (Thread *)((void *)0);   10686   my_thr___0 = (Thread *)((void *)0);
10684   map_pthread_t_to_Thread_INIT();   10687   map_pthread_t_to_Thread_INIT();
10685   my_thr___0 = map_threads_maybe_lookup(tid);   10688   my_thr___0 = map_threads_maybe_lookup(tid);
10686   if (my_thr___0) {   10689   if (my_thr___0) {
10687     10690  
10688   } else {   10691   } else {
10689     vgPlain_assert_fail((Bool )0, (Char const   *)"my_thr",   10692     vgPlain_assert_fail((Bool )0, (Char const   *)"my_thr",
10690                         (Char const   *)"hg_main.c", 4316,   10693                         (Char const   *)"hg_main.c", 4316,
10691                         (Char const   *)"hg_handle_client_request", "");   10694                         (Char const   *)"hg_handle_client_request", "");
10692   }   10695   }
10693   vgHelgrind_record_error_PthAPIerror(my_thr___0, (HChar *)*(args + 1),   10696   vgHelgrind_record_error_PthAPIerror(my_thr___0, (HChar *)*(args + 1),
10694                                       (Word )*(args + 2), (HChar *)*(args + 3));   10697                                       (Word )*(args + 2), (HChar *)*(args + 3));
10695   break;   10698   break;
10696   case 1212612866UL:   10699   case 1212612866UL:
10697   thr_q = (Thread *)((void *)0);   10700   thr_q = (Thread *)((void *)0);
10698   found = (Bool )0;   10701   found = (Bool )0;
10699   map_pthread_t_to_Thread_INIT();   10702   map_pthread_t_to_Thread_INIT();
10700   found = vgPlain_lookupFM(map_pthread_t_to_Thread, (UWord *)((void *)0),   10703   found = vgPlain_lookupFM(map_pthread_t_to_Thread, (UWord *)((void *)0),
10701                            (UWord *)((Word *)(& thr_q)),   10704                            (UWord *)((Word *)(& thr_q)),
10702                            (UWord )((Word )*(args + 1)));   10705                            (UWord )((Word )*(args + 1)));
10703   if (found) {   10706   if (found) {
10704     10707  
10705   } else {   10708   } else {
10706     vgPlain_assert_fail((Bool )0, (Char const   *)"found",   10709     vgPlain_assert_fail((Bool )0, (Char const   *)"found",
10707                         (Char const   *)"hg_main.c", 4339,   10710                         (Char const   *)"hg_main.c", 4339,
10708                         (Char const   *)"hg_handle_client_request", "");   10711                         (Char const   *)"hg_handle_client_request", "");
10709   }   10712   }
10710   if (found) {   10713   if (found) {
10711     evh__HG_PTHREAD_JOIN_POST(tid, thr_q);   10714     evh__HG_PTHREAD_JOIN_POST(tid, thr_q);
10712   } else {   10715   } else {
10713     10716  
10714   }   10717   }
10715   break;   10718   break;
10716   case 1212612867UL:   10719   case 1212612867UL:
10717   evh__HG_PTHREAD_MUTEX_INIT_POST(tid, (void *)*(args + 1), (Word )*(args + 2));   10720   evh__HG_PTHREAD_MUTEX_INIT_POST(tid, (void *)*(args + 1), (Word )*(args + 2));
10718   break;   10721   break;
10719   case 1212612868UL:   10722   case 1212612868UL:
10720   evh__HG_PTHREAD_MUTEX_DESTROY_PRE(tid, (void *)*(args + 1));   10723   evh__HG_PTHREAD_MUTEX_DESTROY_PRE(tid, (void *)*(args + 1));
10721   break;   10724   break;
10722   case 1212612869UL:   10725   case 1212612869UL:
10723   evh__HG_PTHREAD_MUTEX_UNLOCK_PRE(tid, (void *)*(args + 1));   10726   evh__HG_PTHREAD_MUTEX_UNLOCK_PRE(tid, (void *)*(args + 1));
10724   break;   10727   break;
10725   case 1212612870UL:   10728   case 1212612870UL:
10726   evh__HG_PTHREAD_MUTEX_UNLOCK_POST(tid, (void *)*(args + 1));   10729   evh__HG_PTHREAD_MUTEX_UNLOCK_POST(tid, (void *)*(args + 1));
10727   break;   10730   break;
10728   case 1212612871UL:   10731   case 1212612871UL:
10729   evh__HG_PTHREAD_MUTEX_LOCK_PRE(tid, (void *)*(args + 1), (Word )*(args + 2));   10732   evh__HG_PTHREAD_MUTEX_LOCK_PRE(tid, (void *)*(args + 1), (Word )*(args + 2));
10730   break;   10733   break;
10731   case 1212612872UL:   10734   case 1212612872UL:
10732   evh__HG_PTHREAD_MUTEX_LOCK_POST(tid, (void *)*(args + 1));   10735   evh__HG_PTHREAD_MUTEX_LOCK_POST(tid, (void *)*(args + 1));
10733   break;   10736   break;
10734   case 1212612874UL:   10737   case 1212612874UL:
10735   case 1212612873UL:   10738   case 1212612873UL:
10736   evh__HG_PTHREAD_COND_SIGNAL_PRE(tid, (void *)*(args + 1));   10739   evh__HG_PTHREAD_COND_SIGNAL_PRE(tid, (void *)*(args + 1));
10737   break;   10740   break;
10738   case 1212612875UL:   10741   case 1212612875UL:
10739   tmp___0 = evh__HG_PTHREAD_COND_WAIT_PRE(tid, (void *)*(args + 1),   10742   tmp___0 = evh__HG_PTHREAD_COND_WAIT_PRE(tid, (void *)*(args + 1),
10740                                           (void *)*(args + 2));   10743                                           (void *)*(args + 2));
10741   mutex_is_valid = tmp___0;   10744   mutex_is_valid = tmp___0;
10742   if (mutex_is_valid) {   10745   if (mutex_is_valid) {
10743     *ret = (UWord )1;   10746     *ret = (UWord )1;
10744   } else {   10747   } else {
10745     *ret = (UWord )0;   10748     *ret = (UWord )0;
10746   }   10749   }
10747   break;   10750   break;
10748   case 1212612877UL:   10751   case 1212612877UL:
10749   evh__HG_PTHREAD_COND_DESTROY_PRE(tid, (void *)*(args + 1));   10752   evh__HG_PTHREAD_COND_DESTROY_PRE(tid, (void *)*(args + 1));
10750   break;   10753   break;
10751   case 1212612876UL:   10754   case 1212612876UL:
10752   evh__HG_PTHREAD_COND_WAIT_POST(tid, (void *)*(args + 1), (void *)*(args + 2));   10755   evh__HG_PTHREAD_COND_WAIT_POST(tid, (void *)*(args + 1), (void *)*(args + 2));
10753   break;   10756   break;
10754   case 1212612878UL:   10757   case 1212612878UL:
10755   evh__HG_PTHREAD_RWLOCK_INIT_POST(tid, (void *)*(args + 1));   10758   evh__HG_PTHREAD_RWLOCK_INIT_POST(tid, (void *)*(args + 1));
10756   break;   10759   break;
10757   case 1212612879UL:   10760   case 1212612879UL:
10758   evh__HG_PTHREAD_RWLOCK_DESTROY_PRE(tid, (void *)*(args + 1));   10761   evh__HG_PTHREAD_RWLOCK_DESTROY_PRE(tid, (void *)*(args + 1));
10759   break;   10762   break;
10760   case 1212612880UL:   10763   case 1212612880UL:
10761   evh__HG_PTHREAD_RWLOCK_LOCK_PRE(tid, (void *)*(args + 1), (Word )*(args + 2),   10764   evh__HG_PTHREAD_RWLOCK_LOCK_PRE(tid, (void *)*(args + 1), (Word )*(args + 2),
10762                                   (Word )*(args + 3));   10765                                   (Word )*(args + 3));
10763   break;   10766   break;
10764   case 1212612881UL:   10767   case 1212612881UL:
10765   evh__HG_PTHREAD_RWLOCK_LOCK_POST(tid, (void *)*(args + 1), (Word )*(args + 2));   10768   evh__HG_PTHREAD_RWLOCK_LOCK_POST(tid, (void *)*(args + 1), (Word )*(args + 2));
10766   break;   10769   break;
10767   case 1212612882UL:   10770   case 1212612882UL:
10768   evh__HG_PTHREAD_RWLOCK_UNLOCK_PRE(tid, (void *)*(args + 1));   10771   evh__HG_PTHREAD_RWLOCK_UNLOCK_PRE(tid, (void *)*(args + 1));
10769   break;   10772   break;
10770   case 1212612883UL:   10773   case 1212612883UL:
10771   evh__HG_PTHREAD_RWLOCK_UNLOCK_POST(tid, (void *)*(args + 1));   10774   evh__HG_PTHREAD_RWLOCK_UNLOCK_POST(tid, (void *)*(args + 1));
10772   break;   10775   break;
10773   case 1212612884UL:   10776   case 1212612884UL:
10774   evh__HG_POSIX_SEM_INIT_POST(tid, (void *)*(args + 1), *(args + 2));   10777   evh__HG_POSIX_SEM_INIT_POST(tid, (void *)*(args + 1), *(args + 2));
10775   break;   10778   break;
10776   case 1212612885UL:   10779   case 1212612885UL:
10777   evh__HG_POSIX_SEM_DESTROY_PRE(tid, (void *)*(args + 1));   10780   evh__HG_POSIX_SEM_DESTROY_PRE(tid, (void *)*(args + 1));
10778   break;   10781   break;
10779   case 1212612886UL:   10782   case 1212612886UL:
10780   evh__HG_POSIX_SEM_POST_PRE(tid, (void *)*(args + 1));   10783   evh__HG_POSIX_SEM_POST_PRE(tid, (void *)*(args + 1));
10781   break;   10784   break;
10782   case 1212612887UL:   10785   case 1212612887UL:
10783   evh__HG_POSIX_SEM_WAIT_POST(tid, (void *)*(args + 1));   10786   evh__HG_POSIX_SEM_WAIT_POST(tid, (void *)*(args + 1));
10784   break;   10787   break;
10785   case 1212612888UL:   10788   case 1212612888UL:
10786   evh__HG_PTHREAD_BARRIER_INIT_PRE(tid, (void *)*(args + 1), *(args + 2),   10789   evh__HG_PTHREAD_BARRIER_INIT_PRE(tid, (void *)*(args + 1), *(args + 2),
10787                                    *(args + 3));   10790                                    *(args + 3));
10788   break;   10791   break;
10789   case 1212612905UL:   10792   case 1212612905UL:
10790   evh__HG_PTHREAD_BARRIER_RESIZE_PRE(tid, (void *)*(args + 1), *(args + 2));   10793   evh__HG_PTHREAD_BARRIER_RESIZE_PRE(tid, (void *)*(args + 1), *(args + 2));
10791   break;   10794   break;
10792   case 1212612889UL:   10795   case 1212612889UL:
10793   evh__HG_PTHREAD_BARRIER_WAIT_PRE(tid, (void *)*(args + 1));   10796   evh__HG_PTHREAD_BARRIER_WAIT_PRE(tid, (void *)*(args + 1));
10794   break;   10797   break;
10795   case 1212612890UL:   10798   case 1212612890UL:
10796   evh__HG_PTHREAD_BARRIER_DESTROY_PRE(tid, (void *)*(args + 1));   10799   evh__HG_PTHREAD_BARRIER_DESTROY_PRE(tid, (void *)*(args + 1));
10797   break;   10800   break;
10798   case 1212612891UL:   10801   case 1212612891UL:
10799   evh__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_PRE(tid, (void *)*(args + 1));   10802   evh__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_PRE(tid, (void *)*(args + 1));
10800   break;   10803   break;
10801   case 1212612892UL:   10804   case 1212612892UL:
10802   evh__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_POST(tid, (void *)*(args + 1));   10805   evh__HG_PTHREAD_SPIN_INIT_OR_UNLOCK_POST(tid, (void *)*(args + 1));
10803   break;   10806   break;
10804   case 1212612893UL:   10807   case 1212612893UL:
10805   evh__HG_PTHREAD_SPIN_LOCK_PRE(tid, (void *)*(args + 1), (Word )*(args + 2));   10808   evh__HG_PTHREAD_SPIN_LOCK_PRE(tid, (void *)*(args + 1), (Word )*(args + 2));
10806   break;   10809   break;
10807   case 1212612894UL:   10810   case 1212612894UL:
10808   evh__HG_PTHREAD_SPIN_LOCK_POST(tid, (void *)*(args + 1));   10811   evh__HG_PTHREAD_SPIN_LOCK_POST(tid, (void *)*(args + 1));
10809   break;   10812   break;
10810   case 1212612895UL:   10813   case 1212612895UL:
10811   evh__HG_PTHREAD_SPIN_DESTROY_PRE(tid, (void *)*(args + 1));   10814   evh__HG_PTHREAD_SPIN_DESTROY_PRE(tid, (void *)*(args + 1));
10812   break;   10815   break;
10813   case 1212612896UL:   10816   case 1212612896UL:
10814   who = (HChar *)*(args + 1);   10817   who = (HChar *)*(args + 1);
10815   tmp___1 = map_threads_maybe_lookup(tid);   10818   tmp___1 = map_threads_maybe_lookup(tid);
10816   thr = tmp___1;   10819   thr = tmp___1;
10817   if (thr) {   10820   if (thr) {
10818     10821  
10819   } else {   10822   } else {
10820     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   10823     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
10821                         (Char const   *)"hg_main.c", 4503,   10824                         (Char const   *)"hg_main.c", 4503,
10822                         (Char const   *)"hg_handle_client_request", "");   10825                         (Char const   *)"hg_handle_client_request", "");
10823   }   10826   }
10824   if (who) {   10827   if (who) {
10825     10828  
10826   } else {   10829   } else {
10827     vgPlain_assert_fail((Bool )0, (Char const   *)"who",   10830     vgPlain_assert_fail((Bool )0, (Char const   *)"who",
10828                         (Char const   *)"hg_main.c", 4504,   10831                         (Char const   *)"hg_main.c", 4504,
10829                         (Char const   *)"hg_handle_client_request", "");   10832                         (Char const   *)"hg_handle_client_request", "");
10830   }   10833   }
10831   tmp___2 = vgPlain_strlen((Char const   *)who);   10834   tmp___2 = vgPlain_strlen((Char const   *)who);
10832   if (tmp___2 <= 50UL) {   10835   if (tmp___2 <= 50UL) {
10833     10836  
10834   } else {   10837   } else {
10835     vgPlain_assert_fail((Bool )0, (Char const   *)"VG_(strlen)(who) <= 50",   10838     vgPlain_assert_fail((Bool )0, (Char const   *)"VG_(strlen)(who) <= 50",
10836                         (Char const   *)"hg_main.c", 4505,   10839                         (Char const   *)"hg_main.c", 4505,
10837                         (Char const   *)"hg_handle_client_request", "");   10840                         (Char const   *)"hg_handle_client_request", "");
10838   }   10841   }
10839   vgPlain_sprintf((Char *)(buf), "Unimplemented client request macro \"%s\"",   10842   vgPlain_sprintf((Char *)(buf), "Unimplemented client request macro \"%s\"",
10840                   who);   10843                   who);
10841   vgHelgrind_record_error_Misc(thr, buf);   10844   vgHelgrind_record_error_Misc(thr, buf);
10842   break;   10845   break;
10843   case 1212612897UL:   10846   case 1212612897UL:
10844   evh__HG_USERSO_SEND_PRE(tid, *(args + 1));   10847   evh__HG_USERSO_SEND_PRE(tid, *(args + 1));
10845   break;   10848   break;
10846   case 1212612898UL:   10849   case 1212612898UL:
10847   evh__HG_USERSO_RECV_POST(tid, *(args + 1));   10850   evh__HG_USERSO_RECV_POST(tid, *(args + 1));
10848   break;   10851   break;
10849   case 1212612899UL:   10852   case 1212612899UL:
10850   evh__HG_USERSO_FORGET_ALL(tid, *(args + 1));   10853   evh__HG_USERSO_FORGET_ALL(tid, *(args + 1));
10851   break;   10854   break;
10852   default:   10855   default:
10853   vgPlain_assert_fail((Bool )0, (Char const   *)"0",   10856   vgPlain_assert_fail((Bool )0, (Char const   *)"0",
10854                       (Char const   *)"hg_main.c", 4530,   10857                       (Char const   *)"hg_main.c", 4530,
10855                       (Char const   *)"hg_handle_client_request",   10858                       (Char const   *)"hg_handle_client_request",
10856                       "unhandled Helgrind client request 0x%lx", *(args + 0));   10859                       "unhandled Helgrind client request 0x%lx", *(args + 0));
10857   }   10860   }
10858   return ((Bool )1);   10861   return ((Bool )1);
10859 }   10862 }
10860 }   10863 }
10861 static Bool hg_process_cmd_line_option(Char *arg )   10864 static Bool hg_process_cmd_line_option(Char *arg )
10862 {   10865 {
10863   Char *tmp_str ;   10866   Char *tmp_str ;
10864   Int j ;   10867   Int j ;
10865   SizeT tmp ;   10868   SizeT tmp ;
10866   Bool tmp___0 ;   10869   Bool tmp___0 ;
10867   SizeT tmp___1 ;   10870   SizeT tmp___1 ;
10868   Int tmp___2 ;   10871   Int tmp___2 ;
10869   int tmp___3 ;   10872   int tmp___3 ;
10870   SizeT tmp___4 ;   10873   SizeT tmp___4 ;
10871   Int tmp___5 ;   10874   Int tmp___5 ;
10872   Char *val ;   10875   Char *val ;
10873   SizeT tmp___6 ;   10876   SizeT tmp___6 ;
10874   SizeT tmp___7 ;   10877   SizeT tmp___7 ;
10875   Int tmp___8 ;   10878   Int tmp___8 ;
10876   int tmp___9 ;   10879   int tmp___9 ;
10877   SizeT tmp___10 ;   10880   SizeT tmp___10 ;
10878   Int tmp___11 ;   10881   Int tmp___11 ;
10879   Char *val___0 ;   10882   Char *val___0 ;
10880   SizeT tmp___12 ;   10883   SizeT tmp___12 ;
10881   Char *s ;   10884   Char *s ;
10882   Long n ;   10885   Long n ;
10883   Long tmp___13 ;   10886   Long tmp___13 ;
10884   Int tmp___14 ;   10887   Int tmp___14 ;
10885   int tmp___15 ;   10888   int tmp___15 ;
10886   Int tmp___16 ;   10889   Int tmp___16 ;
10887   Int tmp___17 ;   10890   Int tmp___17 ;
10888   int tmp___18 ;   10891   int tmp___18 ;
10889   Int tmp___19 ;   10892   Int tmp___19 ;
10890   Int tmp___20 ;   10893   Int tmp___20 ;
10891   int tmp___21 ;   10894   int tmp___21 ;
10892   Int tmp___22 ;   10895   Int tmp___22 ;
10893   SizeT tmp___23 ;   10896   SizeT tmp___23 ;
10894   Int tmp___24 ;   10897   Int tmp___24 ;
10895   int tmp___25 ;   10898   int tmp___25 ;
10896   SizeT tmp___26 ;   10899   SizeT tmp___26 ;
10897   Int tmp___27 ;   10900   Int tmp___27 ;
10898   Char *val___1 ;   10901   Char *val___1 ;
10899   SizeT tmp___28 ;   10902   SizeT tmp___28 ;
10900   Int tmp___29 ;   10903   Int tmp___29 ;
10901   int tmp___30 ;   10904   int tmp___30 ;
10902   Int tmp___31 ;   10905   Int tmp___31 ;
10903   Int tmp___32 ;   10906   Int tmp___32 ;
10904   int tmp___33 ;   10907   int tmp___33 ;
10905   Int tmp___34 ;   10908   Int tmp___34 ;
10906   SizeT tmp___35 ;   10909   SizeT tmp___35 ;
10907   Int tmp___36 ;   10910   Int tmp___36 ;
10908   int tmp___37 ;   10911   int tmp___37 ;
10909   SizeT tmp___38 ;   10912   SizeT tmp___38 ;
10910   Int tmp___39 ;   10913   Int tmp___39 ;
10911   Char *val___2 ;   10914   Char *val___2 ;
10912   SizeT tmp___40 ;   10915   SizeT tmp___40 ;
10913   Int tmp___41 ;   10916   Int tmp___41 ;
10914   int tmp___42 ;   10917   int tmp___42 ;
10915   Int tmp___43 ;   10918   Int tmp___43 ;
10916   Int tmp___44 ;   10919   Int tmp___44 ;
10917   int tmp___45 ;   10920   int tmp___45 ;
10918   Int tmp___46 ;   10921   Int tmp___46 ;
10919     10922  
10920   {   10923   {
10921   if ((unsigned int )arg != (unsigned int )((void *)0)) {   10924   if ((unsigned int )arg != (unsigned int )((void *)0)) {
10922     if ((unsigned int )"--track-lockorders=" != (unsigned int )((void *)0)) {   10925     if ((unsigned int )"--track-lockorders=" != (unsigned int )((void *)0)) {
10923       tmp___38 = vgPlain_strlen((Char const   *)"--track-lockorders");   10926       tmp___38 = vgPlain_strlen((Char const   *)"--track-lockorders");
10924       tmp___39 = vgPlain_strncmp((Char const   *)arg,   10927       tmp___39 = vgPlain_strncmp((Char const   *)arg,
10925                                  (Char const   *)"--track-lockorders=",   10928                                  (Char const   *)"--track-lockorders=",
10926                                  tmp___38 + 1UL);   10929                                  tmp___38 + 1UL);
10927       if (tmp___39 == 0) {   10930       if (tmp___39 == 0) {
10928         tmp___37 = (int )((Bool )1);   10931         tmp___37 = (int )((Bool )1);
10929       } else {   10932       } else {
10930         tmp___37 = (int )((Bool )0);   10933         tmp___37 = (int )((Bool )0);
10931       }   10934       }
10932     } else {   10935     } else {
10933       tmp___37 = (int )((Bool )0);   10936       tmp___37 = (int )((Bool )0);
10934     }   10937     }
10935   } else {   10938   } else {
10936     tmp___37 = (int )((Bool )0);   10939     tmp___37 = (int )((Bool )0);
10937   }   10940   }
10938   if (tmp___37) {   10941   if (tmp___37) {
10939     tmp___40 = vgPlain_strlen((Char const   *)"--track-lockorders");   10942     tmp___40 = vgPlain_strlen((Char const   *)"--track-lockorders");
10940     val___2 = arg + (tmp___40 + 1UL);   10943     val___2 = arg + (tmp___40 + 1UL);
10941     if ((unsigned int )val___2 != (unsigned int )((void *)0)) {   10944     if ((unsigned int )val___2 != (unsigned int )((void *)0)) {
10942       if ((unsigned int )"yes" != (unsigned int )((void *)0)) {   10945       if ((unsigned int )"yes" != (unsigned int )((void *)0)) {
10943         tmp___46 = vgPlain_strcmp((Char const   *)val___2, (Char const   *)"yes");   10946         tmp___46 = vgPlain_strcmp((Char const   *)val___2, (Char const   *)"yes");
10944         if (tmp___46 == 0) {   10947         if (tmp___46 == 0) {
10945           tmp___45 = (int )((Bool )1);   10948           tmp___45 = (int )((Bool )1);
10946         } else {   10949         } else {
10947           tmp___45 = (int )((Bool )0);   10950           tmp___45 = (int )((Bool )0);
10948         }   10951         }
10949       } else {   10952       } else {
10950         tmp___45 = (int )((Bool )0);   10953         tmp___45 = (int )((Bool )0);
10951       }   10954       }
10952     } else {   10955     } else {
10953       tmp___45 = (int )((Bool )0);   10956       tmp___45 = (int )((Bool )0);
10954     }   10957     }
10955     if (tmp___45) {   10958     if (tmp___45) {
10956       vgHelgrind_clo_track_lockorders = (Bool )1;   10959       vgHelgrind_clo_track_lockorders = (Bool )1;
10957     } else {   10960     } else {
10958       if ((unsigned int )val___2 != (unsigned int )((void *)0)) {   10961       if ((unsigned int )val___2 != (unsigned int )((void *)0)) {
10959         if ((unsigned int )"no" != (unsigned int )((void *)0)) {   10962         if ((unsigned int )"no" != (unsigned int )((void *)0)) {
10960           tmp___43 = vgPlain_strcmp((Char const   *)val___2,   10963           tmp___43 = vgPlain_strcmp((Char const   *)val___2,
10961                                     (Char const   *)"no");   10964                                     (Char const   *)"no");
10962           if (tmp___43 == 0) {   10965           if (tmp___43 == 0) {
10963             tmp___42 = (int )((Bool )1);   10966             tmp___42 = (int )((Bool )1);
10964           } else {   10967           } else {
10965             tmp___42 = (int )((Bool )0);   10968             tmp___42 = (int )((Bool )0);
10966           }   10969           }
10967         } else {   10970         } else {
10968           tmp___42 = (int )((Bool )0);   10971           tmp___42 = (int )((Bool )0);
10969         }   10972         }
10970       } else {   10973       } else {
10971         tmp___42 = (int )((Bool )0);   10974         tmp___42 = (int )((Bool )0);
10972       }   10975       }
10973       if (tmp___42) {   10976       if (tmp___42) {
10974         vgHelgrind_clo_track_lockorders = (Bool )0;   10977         vgHelgrind_clo_track_lockorders = (Bool )0;
10975       } else {   10978       } else {
10976     10979  
10977       }   10980       }
10978     }   10981     }
10979   } else {   10982   } else {
10980     _L___4: /* CIL Label */   10983     _L___4: /* CIL Label */
10981     if ((unsigned int )arg != (unsigned int )((void *)0)) {   10984     if ((unsigned int )arg != (unsigned int )((void *)0)) {
10982       if ((unsigned int )"--cmp-race-err-addrs=" != (unsigned int )((void *)0)) {   10985       if ((unsigned int )"--cmp-race-err-addrs=" != (unsigned int )((void *)0)) {
10983         tmp___26 = vgPlain_strlen((Char const   *)"--cmp-race-err-addrs");   10986         tmp___26 = vgPlain_strlen((Char const   *)"--cmp-race-err-addrs");
10984         tmp___27 = vgPlain_strncmp((Char const   *)arg,   10987         tmp___27 = vgPlain_strncmp((Char const   *)arg,
10985                                    (Char const   *)"--cmp-race-err-addrs=",   10988                                    (Char const   *)"--cmp-race-err-addrs=",
10986                                    tmp___26 + 1UL);   10989                                    tmp___26 + 1UL);
10987         if (tmp___27 == 0) {   10990         if (tmp___27 == 0) {
10988           tmp___25 = (int )((Bool )1);   10991           tmp___25 = (int )((Bool )1);
10989         } else {   10992         } else {
10990           tmp___25 = (int )((Bool )0);   10993           tmp___25 = (int )((Bool )0);
10991         }   10994         }
10992       } else {   10995       } else {
10993         tmp___25 = (int )((Bool )0);   10996         tmp___25 = (int )((Bool )0);
10994       }   10997       }
10995     } else {   10998     } else {
10996       tmp___25 = (int )((Bool )0);   10999       tmp___25 = (int )((Bool )0);
10997     }   11000     }
10998     if (tmp___25) {   11001     if (tmp___25) {
10999       tmp___28 = vgPlain_strlen((Char const   *)"--cmp-race-err-addrs");   11002       tmp___28 = vgPlain_strlen((Char const   *)"--cmp-race-err-addrs");
11000       val___1 = arg + (tmp___28 + 1UL);   11003       val___1 = arg + (tmp___28 + 1UL);
11001       if ((unsigned int )val___1 != (unsigned int )((void *)0)) {   11004       if ((unsigned int )val___1 != (unsigned int )((void *)0)) {
11002         if ((unsigned int )"yes" != (unsigned int )((void *)0)) {   11005         if ((unsigned int )"yes" != (unsigned int )((void *)0)) {
11003           tmp___34 = vgPlain_strcmp((Char const   *)val___1,   11006           tmp___34 = vgPlain_strcmp((Char const   *)val___1,
11004                                     (Char const   *)"yes");   11007                                     (Char const   *)"yes");
11005           if (tmp___34 == 0) {   11008           if (tmp___34 == 0) {
11006             tmp___33 = (int )((Bool )1);   11009             tmp___33 = (int )((Bool )1);
11007           } else {   11010           } else {
11008             tmp___33 = (int )((Bool )0);   11011             tmp___33 = (int )((Bool )0);
11009           }   11012           }
11010         } else {   11013         } else {
11011           tmp___33 = (int )((Bool )0);   11014           tmp___33 = (int )((Bool )0);
11012         }   11015         }
11013       } else {   11016       } else {
11014         tmp___33 = (int )((Bool )0);   11017         tmp___33 = (int )((Bool )0);
11015       }   11018       }
11016       if (tmp___33) {   11019       if (tmp___33) {
11017         vgHelgrind_clo_cmp_race_err_addrs = (Bool )1;   11020         vgHelgrind_clo_cmp_race_err_addrs = (Bool )1;
11018       } else {   11021       } else {
11019         if ((unsigned int )val___1 != (unsigned int )((void *)0)) {   11022         if ((unsigned int )val___1 != (unsigned int )((void *)0)) {
11020           if ((unsigned int )"no" != (unsigned int )((void *)0)) {   11023           if ((unsigned int )"no" != (unsigned int )((void *)0)) {
11021             tmp___31 = vgPlain_strcmp((Char const   *)val___1,   11024             tmp___31 = vgPlain_strcmp((Char const   *)val___1,
11022                                       (Char const   *)"no");   11025                                       (Char const   *)"no");
11023             if (tmp___31 == 0) {   11026             if (tmp___31 == 0) {
11024               tmp___30 = (int )((Bool )1);   11027               tmp___30 = (int )((Bool )1);
11025             } else {   11028             } else {
11026               tmp___30 = (int )((Bool )0);   11029               tmp___30 = (int )((Bool )0);
11027             }   11030             }
11028           } else {   11031           } else {
11029             tmp___30 = (int )((Bool )0);   11032             tmp___30 = (int )((Bool )0);
11030           }   11033           }
11031         } else {   11034         } else {
11032           tmp___30 = (int )((Bool )0);   11035           tmp___30 = (int )((Bool )0);
11033         }   11036         }
11034         if (tmp___30) {   11037         if (tmp___30) {
11035           vgHelgrind_clo_cmp_race_err_addrs = (Bool )0;   11038           vgHelgrind_clo_cmp_race_err_addrs = (Bool )0;
11036         } else {   11039         } else {
11037     11040  
11038         }   11041         }
11039       }   11042       }
11040     } else {   11043     } else {
11041       _L___3: /* CIL Label */   11044       _L___3: /* CIL Label */
11042       if ((unsigned int )arg != (unsigned int )((void *)0)) {   11045       if ((unsigned int )arg != (unsigned int )((void *)0)) {
11043         if ((unsigned int )"--history-level=none" != (unsigned int )((void *)0)) {   11046         if ((unsigned int )"--history-level=none" != (unsigned int )((void *)0)) {
11044           tmp___22 = vgPlain_strcmp((Char const   *)arg,   11047           tmp___22 = vgPlain_strcmp((Char const   *)arg,
11045                                     (Char const   *)"--history-level=none");   11048                                     (Char const   *)"--history-level=none");
11046           if (tmp___22 == 0) {   11049           if (tmp___22 == 0) {
11047             tmp___21 = (int )((Bool )1);   11050             tmp___21 = (int )((Bool )1);
11048           } else {   11051           } else {
11049             tmp___21 = (int )((Bool )0);   11052             tmp___21 = (int )((Bool )0);
11050           }   11053           }
11051         } else {   11054         } else {
11052           tmp___21 = (int )((Bool )0);   11055           tmp___21 = (int )((Bool )0);
11053         }   11056         }
11054       } else {   11057       } else {
11055         tmp___21 = (int )((Bool )0);   11058         tmp___21 = (int )((Bool )0);
11056       }   11059       }
11057       if (tmp___21) {   11060       if (tmp___21) {
11058         vgHelgrind_clo_history_level = (UWord )0;   11061         vgHelgrind_clo_history_level = (UWord )0;
11059       } else {   11062       } else {
11060         _L___2: /* CIL Label */   11063         _L___2: /* CIL Label */
11061         if ((unsigned int )arg != (unsigned int )((void *)0)) {   11064         if ((unsigned int )arg != (unsigned int )((void *)0)) {
11062           if ((unsigned int )"--history-level=approx" != (unsigned int )((void *)0)) {   11065           if ((unsigned int )"--history-level=approx" != (unsigned int )((void *)0)) {
11063             tmp___19 = vgPlain_strcmp((Char const   *)arg,   11066             tmp___19 = vgPlain_strcmp((Char const   *)arg,
11064                                       (Char const   *)"--history-level=approx");   11067                                       (Char const   *)"--history-level=approx");
11065             if (tmp___19 == 0) {   11068             if (tmp___19 == 0) {
11066               tmp___18 = (int )((Bool )1);   11069               tmp___18 = (int )((Bool )1);
11067             } else {   11070             } else {
11068               tmp___18 = (int )((Bool )0);   11071               tmp___18 = (int )((Bool )0);
11069             }   11072             }
11070           } else {   11073           } else {
11071             tmp___18 = (int )((Bool )0);   11074             tmp___18 = (int )((Bool )0);
11072           }   11075           }
11073         } else {   11076         } else {
11074           tmp___18 = (int )((Bool )0);   11077           tmp___18 = (int )((Bool )0);
11075         }   11078         }
11076         if (tmp___18) {   11079         if (tmp___18) {
11077           vgHelgrind_clo_history_level = (UWord )1;   11080           vgHelgrind_clo_history_level = (UWord )1;
11078         } else {   11081         } else {
11079           _L___1: /* CIL Label */   11082           _L___1: /* CIL Label */
11080           if ((unsigned int )arg != (unsigned int )((void *)0)) {   11083           if ((unsigned int )arg != (unsigned int )((void *)0)) {
11081             if ((unsigned int )"--history-level=full" != (unsigned int )((void *)0)) {   11084             if ((unsigned int )"--history-level=full" != (unsigned int )((void *)0)) {
11082               tmp___16 = vgPlain_strcmp((Char const   *)arg,   11085               tmp___16 = vgPlain_strcmp((Char const   *)arg,
11083                                         (Char const   *)"--history-level=full");   11086                                         (Char const   *)"--history-level=full");
11084               if (tmp___16 == 0) {   11087               if (tmp___16 == 0) {
11085                 tmp___15 = (int )((Bool )1);   11088                 tmp___15 = (int )((Bool )1);
11086               } else {   11089               } else {
11087                 tmp___15 = (int )((Bool )0);   11090                 tmp___15 = (int )((Bool )0);
11088               }   11091               }
11089             } else {   11092             } else {
11090               tmp___15 = (int )((Bool )0);   11093               tmp___15 = (int )((Bool )0);
11091             }   11094             }
11092           } else {   11095           } else {
11093             tmp___15 = (int )((Bool )0);   11096             tmp___15 = (int )((Bool )0);
11094           }   11097           }
11095           if (tmp___15) {   11098           if (tmp___15) {
11096             vgHelgrind_clo_history_level = (UWord )2;   11099             vgHelgrind_clo_history_level = (UWord )2;
11097           } else {   11100           } else {
11098             _L___0: /* CIL Label */   11101             _L___0: /* CIL Label */
11099             if ((unsigned int )arg != (unsigned int )((void *)0)) {   11102             if ((unsigned int )arg != (unsigned int )((void *)0)) {
11100               if ((unsigned int )"--conflict-cache-size=" != (unsigned int )((void *)0)) {   11103               if ((unsigned int )"--conflict-cache-size=" != (unsigned int )((void *)0)) {
11101                 tmp___10 = vgPlain_strlen((Char const   *)"--conflict-cache-size");   11104                 tmp___10 = vgPlain_strlen((Char const   *)"--conflict-cache-size");
11102                 tmp___11 = vgPlain_strncmp((Char const   *)arg,   11105                 tmp___11 = vgPlain_strncmp((Char const   *)arg,
11103                                            (Char const   *)"--conflict-cache-size=",   11106                                            (Char const   *)"--conflict-cache-size=",
11104                                            tmp___10 + 1UL);   11107                                            tmp___10 + 1UL);
11105                 if (tmp___11 == 0) {   11108                 if (tmp___11 == 0) {
11106                   tmp___9 = (int )((Bool )1);   11109                   tmp___9 = (int )((Bool )1);
11107                 } else {   11110                 } else {
11108                   tmp___9 = (int )((Bool )0);   11111                   tmp___9 = (int )((Bool )0);
11109                 }   11112                 }
11110               } else {   11113               } else {
11111                 tmp___9 = (int )((Bool )0);   11114                 tmp___9 = (int )((Bool )0);
11112               }   11115               }
11113             } else {   11116             } else {
11114               tmp___9 = (int )((Bool )0);   11117               tmp___9 = (int )((Bool )0);
11115             }   11118             }
11116             if (tmp___9) {   11119             if (tmp___9) {
11117               tmp___12 = vgPlain_strlen((Char const   *)"--conflict-cache-size");   11120               tmp___12 = vgPlain_strlen((Char const   *)"--conflict-cache-size");
11118               val___0 = arg + (tmp___12 + 1UL);   11121               val___0 = arg + (tmp___12 + 1UL);
11119               tmp___13 = vgPlain_strtoll10(val___0, & s);   11122               tmp___13 = vgPlain_strtoll10(val___0, & s);
11120               n = tmp___13;   11123               n = tmp___13;
11121               vgHelgrind_clo_conflict_cache_size = (UWord )n;   11124               vgHelgrind_clo_conflict_cache_size = (UWord )n;
11122               if (0 != (int )*(s + 0)) {   11125               if (0 != (int )*(s + 0)) {
11123                 vgPlain_fmsg_bad_option((HChar *)arg, "");   11126                 vgPlain_fmsg_bad_option((HChar *)arg, "");
11124               } else   11127               } else
11125               if ((Long )vgHelgrind_clo_conflict_cache_size != n) {   11128               if ((Long )vgHelgrind_clo_conflict_cache_size != n) {
11126                 vgPlain_fmsg_bad_option((HChar *)arg, "");   11129                 vgPlain_fmsg_bad_option((HChar *)arg, "");
11127               } else {   11130               } else {
11128     11131  
11129               }   11132               }
11130               if (vgHelgrind_clo_conflict_cache_size < 10000UL) {   11133               if (vgHelgrind_clo_conflict_cache_size < 10000UL) {
11131                 vgPlain_fmsg_bad_option((HChar *)arg,   11134                 vgPlain_fmsg_bad_option((HChar *)arg,
11132                                         "\'%s\' argument must be between %lld and %lld\n",   11135                                         "\'%s\' argument must be between %lld and %lld\n",
11133                                         "--conflict-cache-size", (Long )10000,   11136                                         "--conflict-cache-size", (Long )10000,
11134                                         (Long )30000000);   11137                                         (Long )30000000);
11135               } else   11138               } else
11136               if (vgHelgrind_clo_conflict_cache_size > 30000000UL) {   11139               if (vgHelgrind_clo_conflict_cache_size > 30000000UL) {
11137                 vgPlain_fmsg_bad_option((HChar *)arg,   11140                 vgPlain_fmsg_bad_option((HChar *)arg,
11138                                         "\'%s\' argument must be between %lld and %lld\n",   11141                                         "\'%s\' argument must be between %lld and %lld\n",
11139                                         "--conflict-cache-size", (Long )10000,   11142                                         "--conflict-cache-size", (Long )10000,
11140                                         (Long )30000000);   11143                                         (Long )30000000);
11141               } else {   11144               } else {
11142     11145  
11143               }   11146               }
11144             } else {   11147             } else {
11145               _L: /* CIL Label */   11148               _L: /* CIL Label */
11146               if ((unsigned int )arg != (unsigned int )((void *)0)) {   11149               if ((unsigned int )arg != (unsigned int )((void *)0)) {
11147                 if ((unsigned int )"--hg-sanity-flags=" != (unsigned int )((void *)0)) {   11150                 if ((unsigned int )"--hg-sanity-flags=" != (unsigned int )((void *)0)) {
11148                   tmp___4 = vgPlain_strlen((Char const   *)"--hg-sanity-flags");   11151                   tmp___4 = vgPlain_strlen((Char const   *)"--hg-sanity-flags");
11149                   tmp___5 = vgPlain_strncmp((Char const   *)arg,   11152                   tmp___5 = vgPlain_strncmp((Char const   *)arg,
11150                                             (Char const   *)"--hg-sanity-flags=",   11153                                             (Char const   *)"--hg-sanity-flags=",
11151                                             tmp___4 + 1UL);   11154                                             tmp___4 + 1UL);
11152                   if (tmp___5 == 0) {   11155                   if (tmp___5 == 0) {
11153                     tmp___3 = (int )((Bool )1);   11156                     tmp___3 = (int )((Bool )1);
11154                   } else {   11157                   } else {
11155                     tmp___3 = (int )((Bool )0);   11158                     tmp___3 = (int )((Bool )0);
11156                   }   11159                   }
11157                 } else {   11160                 } else {
11158                   tmp___3 = (int )((Bool )0);   11161                   tmp___3 = (int )((Bool )0);
11159                 }   11162                 }
11160               } else {   11163               } else {
11161                 tmp___3 = (int )((Bool )0);   11164                 tmp___3 = (int )((Bool )0);
11162               }   11165               }
11163               if (tmp___3) {   11166               if (tmp___3) {
11164                 tmp___6 = vgPlain_strlen((Char const   *)"--hg-sanity-flags");   11167                 tmp___6 = vgPlain_strlen((Char const   *)"--hg-sanity-flags");
11165                 val = arg + (tmp___6 + 1UL);   11168                 val = arg + (tmp___6 + 1UL);
11166                 tmp_str = val;   11169                 tmp_str = val;
11167                 tmp = vgPlain_strlen((Char const   *)tmp_str);   11170                 tmp = vgPlain_strlen((Char const   *)tmp_str);
11168                 if (6UL != tmp) {   11171                 if (6UL != tmp) {
11169                   vgPlain_message((VgMsgKind )1,   11172                   vgPlain_message((VgMsgKind )1,
11170                                   "--hg-sanity-flags argument must have 6 digits\n");   11173                                   "--hg-sanity-flags argument must have 6 digits\n");
11171                   return ((Bool )0);   11174                   return ((Bool )0);
11172                 } else {   11175                 } else {
11173     11176  
11174                 }   11177                 }
11175                 j = 0;   11178                 j = 0;
11176                 while (j < 6) {   11179                 while (j < 6) {
11177                   if (48 == (int )*(tmp_str + j)) {   11180                   if (48 == (int )*(tmp_str + j)) {
11178     11181  
11179                   } else   11182                   } else
11180                   if (49 == (int )*(tmp_str + j)) {   11183                   if (49 == (int )*(tmp_str + j)) {
11181                     vgHelgrind_clo_sanity_flags |= (long )(1 << (5 - j));   11184                     vgHelgrind_clo_sanity_flags |= (long )(1 << (5 - j));
11182                   } else {   11185                   } else {
11183                     vgPlain_message((VgMsgKind )1,   11186                     vgPlain_message((VgMsgKind )1,
11184                                     "--hg-sanity-flags argument can only contain 0s and 1s\n");   11187                                     "--hg-sanity-flags argument can only contain 0s and 1s\n");
11185                     return ((Bool )0);   11188                     return ((Bool )0);
11186                   }   11189                   }
11187                   j ++;   11190                   j ++;
11188                 }   11191                 }
11189               } else {   11192               } else {
11190                 tmp___0 = vgPlain_replacement_malloc_process_cmd_line_option(arg);   11193                 tmp___0 = vgPlain_replacement_malloc_process_cmd_line_option(arg);
11191                 return (tmp___0);   11194                 return (tmp___0);
11192               }   11195               }
11193             }   11196             }
11194           }   11197           }
11195         }   11198         }
11196       }   11199       }
11197     }   11200     }
11198   }   11201   }
11199   return ((Bool )1);   11202   return ((Bool )1);
11200 }   11203 }
11201 }   11204 }
11202 static void hg_print_usage(void)   11205 static void hg_print_usage(void)
11203 {   11206 {
11204     11207  
11205     11208  
11206   {   11209   {
11207   vgPlain_printf("    --track-lockorders=no|yes show lock ordering errors? [yes]\n    --history-level=none|approx|full [full]\n       full:   show both stack traces for a data race (can be very slow)\n       approx: full trace for one thread, approx for the other (faster)\n       none:   only show trace for one thread in a race (fastest)\n    --conflict-cache-size=N   size of \'full\' history cache [1000000]\n");   11210   vgPlain_printf("    --track-lockorders=no|yes show lock ordering errors? [yes]\n    --history-level=none|approx|full [full]\n       full:   show both stack traces for a data race (can be very slow)\n       approx: full trace for one thread, approx for the other (faster)\n       none:   only show trace for one thread in a race (fastest)\n    --conflict-cache-size=N   size of \'full\' history cache [1000000]\n");
11208   return;   11211   return;
11209 }   11212 }
11210 }   11213 }
11211 static void hg_print_debug_usage(void)   11214 static void hg_print_debug_usage(void)
11212 {   11215 {
11213     11216  
11214     11217  
11215   {   11218   {
11216   vgPlain_printf("    --cmp-race-err-addrs=no|yes  are data addresses in race errors significant? [no]\n");   11219   vgPlain_printf("    --cmp-race-err-addrs=no|yes  are data addresses in race errors significant? [no]\n");
11217   vgPlain_printf("    --hg-sanity-flags=<XXXXXX>   sanity check   at events (X = 0|1) [000000]\n");   11220   vgPlain_printf("    --hg-sanity-flags=<XXXXXX>   sanity check   at events (X = 0|1) [000000]\n");
11218   vgPlain_printf("    --hg-sanity-flags values:\n");   11221   vgPlain_printf("    --hg-sanity-flags values:\n");
11219   vgPlain_printf("       010000   after changes to lock-order-acquisition-graph\n");   11222   vgPlain_printf("       010000   after changes to lock-order-acquisition-graph\n");
11220   vgPlain_printf("       001000   at memory accesses (NB: not currently used)\n");   11223   vgPlain_printf("       001000   at memory accesses (NB: not currently used)\n");
11221   vgPlain_printf("       000100   at mem permission setting for ranges >= %d bytes\n",   11224   vgPlain_printf("       000100   at mem permission setting for ranges >= %d bytes\n",
11222                  256);   11225                  256);
11223   vgPlain_printf("       000010   at lock/unlock events\n");   11226   vgPlain_printf("       000010   at lock/unlock events\n");
11224   vgPlain_printf("       000001   at thread create/join events\n");   11227   vgPlain_printf("       000001   at thread create/join events\n");
11225   return;   11228   return;
11226 }   11229 }
11227 }   11230 }
11228 static void hg_fini(Int exitcode )   11231 static void hg_fini(Int exitcode )
11229 {   11232 {
11230   UWord tmp ;   11233   UWord tmp ;
11231   UWord tmp___0 ;   11234   UWord tmp___0 ;
11232   ULong tmp___1 ;   11235   ULong tmp___1 ;
11233   ULong tmp___2 ;   11236   ULong tmp___2 ;
11234   UWord tmp___3 ;   11237   UWord tmp___3 ;
11235   UWord tmp___4 ;   11238   UWord tmp___4 ;
11236   UWord tmp___5 ;   11239   UWord tmp___5 ;
11237   UWord tmp___6 ;   11240   UWord tmp___6 ;
11238     11241  
11239   {   11242   {
11240   if (vgPlain_clo_verbosity == 1) {   11243   if (vgPlain_clo_verbosity == 1) {
11241     if (! vgPlain_clo_xml) {   11244     if (! vgPlain_clo_xml) {
11242       vgPlain_message((VgMsgKind )1,   11245       vgPlain_message((VgMsgKind )1,
11243                       "For counts of detected and suppressed errors, rerun with: -v\n");   11246                       "For counts of detected and suppressed errors, rerun with: -v\n");
11244     } else {   11247     } else {
11245     11248  
11246     }   11249     }
11247   } else {   11250   } else {
11248     11251  
11249   }   11252   }
11250   if (vgPlain_clo_verbosity == 1) {   11253   if (vgPlain_clo_verbosity == 1) {
11251     if (! vgPlain_clo_xml) {   11254     if (! vgPlain_clo_xml) {
11252       if (vgHelgrind_clo_history_level >= 2UL) {   11255       if (vgHelgrind_clo_history_level >= 2UL) {
11253         vgPlain_umsg("Use --history-level=approx or =none to gain increased speed, at\n");   11256         vgPlain_umsg("Use --history-level=approx or =none to gain increased speed, at\n");
11254         vgPlain_umsg("the cost of reduced accuracy of conflicting-access information\n");   11257         vgPlain_umsg("the cost of reduced accuracy of conflicting-access information\n");
11255       } else {   11258       } else {
11256     11259  
11257       }   11260       }
11258     } else {   11261     } else {
11259     11262  
11260     }   11263     }
11261   } else {   11264   } else {
11262     11265  
11263   }   11266   }
11264   if (vgHelgrind_clo_sanity_flags) {   11267   if (vgHelgrind_clo_sanity_flags) {
11265     all__sanity_check((Char *)"SK_(fini)");   11268     all__sanity_check((Char *)"SK_(fini)");
11266   } else {   11269   } else {
11267     11270  
11268   }   11271   }
11269   if (vgPlain_clo_stats) {   11272   if (vgPlain_clo_stats) {
11270     vgPlain_printf("\n");   11273     vgPlain_printf("\n");
11271     vgHelgrind_ppWSUstats(univ_lsets, (HChar *)"univ_lsets");   11274     vgHelgrind_ppWSUstats(univ_lsets, (HChar *)"univ_lsets");
11272     if (vgHelgrind_clo_track_lockorders) {   11275     if (vgHelgrind_clo_track_lockorders) {
11273       vgPlain_printf("\n");   11276       vgPlain_printf("\n");
11274       vgHelgrind_ppWSUstats(univ_laog, (HChar *)"univ_laog");   11277       vgHelgrind_ppWSUstats(univ_laog, (HChar *)"univ_laog");
11275     } else {   11278     } else {
11276     11279  
11277     }   11280     }
11278     vgPlain_printf("\n");   11281     vgPlain_printf("\n");
11279     tmp = vgHelgrind_cardinalityWSU(univ_lsets);   11282     tmp = vgHelgrind_cardinalityWSU(univ_lsets);
11280     vgPlain_printf("        locksets: %\'8d unique lock sets\n", (Int )tmp);   11283     vgPlain_printf("        locksets: %\'8d unique lock sets\n", (Int )tmp);
11281     if (vgHelgrind_clo_track_lockorders) {   11284     if (vgHelgrind_clo_track_lockorders) {
11282       tmp___0 = vgHelgrind_cardinalityWSU(univ_laog);   11285       tmp___0 = vgHelgrind_cardinalityWSU(univ_laog);
11283       vgPlain_printf("       univ_laog: %\'8d unique lock sets\n", (Int )tmp___0);   11286       vgPlain_printf("       univ_laog: %\'8d unique lock sets\n", (Int )tmp___0);
11284     } else {   11287     } else {
11285     11288  
11286     }   11289     }
11287     tmp___1 = vgHelgrind_stats__LockN_to_P_get_map_size();   11290     tmp___1 = vgHelgrind_stats__LockN_to_P_get_map_size();
11288     vgPlain_printf("  LockN-to-P map: %\'8llu queries (%llu map size)\n",   11291     vgPlain_printf("  LockN-to-P map: %\'8llu queries (%llu map size)\n",
11289                    vgHelgrind_stats__LockN_to_P_queries, tmp___1);   11292                    vgHelgrind_stats__LockN_to_P_queries, tmp___1);
11290     tmp___2 = vgHelgrind_stats__string_table_get_map_size();   11293     tmp___2 = vgHelgrind_stats__string_table_get_map_size();
11291     vgPlain_printf("string table map: %\'8llu queries (%llu map size)\n",   11294     vgPlain_printf("string table map: %\'8llu queries (%llu map size)\n",
11292                    vgHelgrind_stats__string_table_queries, tmp___2);   11295                    vgHelgrind_stats__string_table_queries, tmp___2);
11293     if (vgHelgrind_clo_track_lockorders) {   11296     if (vgHelgrind_clo_track_lockorders) {
11294       if (laog) {   11297       if (laog) {
11295         tmp___3 = vgPlain_sizeFM(laog);   11298         tmp___3 = vgPlain_sizeFM(laog);
11296         tmp___4 = tmp___3;   11299         tmp___4 = tmp___3;
11297       } else {   11300       } else {
11298         tmp___4 = (UWord )0;   11301         tmp___4 = (UWord )0;
11299       }   11302       }
11300       vgPlain_printf("            LAOG: %\'8d map size\n", (Int )tmp___4);   11303       vgPlain_printf("            LAOG: %\'8d map size\n", (Int )tmp___4);
11301       if (laog_exposition) {   11304       if (laog_exposition) {
11302         tmp___5 = vgPlain_sizeFM(laog_exposition);   11305         tmp___5 = vgPlain_sizeFM(laog_exposition);
11303         tmp___6 = tmp___5;   11306         tmp___6 = tmp___5;
11304       } else {   11307       } else {
11305         tmp___6 = (UWord )0;   11308         tmp___6 = (UWord )0;
11306       }   11309       }
11307       vgPlain_printf(" LAOG exposition: %\'8d map size\n", (Int )tmp___6);   11310       vgPlain_printf(" LAOG exposition: %\'8d map size\n", (Int )tmp___6);
11308     } else {   11311     } else {
11309     11312  
11310     }   11313     }
11311     vgPlain_printf("           locks: %\'8lu acquires, %\'lu releases\n",   11314     vgPlain_printf("           locks: %\'8lu acquires, %\'lu releases\n",
11312                    stats__lockN_acquires, stats__lockN_releases);   11315                    stats__lockN_acquires, stats__lockN_releases);
11313     vgPlain_printf("   sanity checks: %\'8lu\n", stats__sanity_checks);   11316     vgPlain_printf("   sanity checks: %\'8lu\n", stats__sanity_checks);
11314     vgPlain_printf("\n");   11317     vgPlain_printf("\n");
11315     libhb_shutdown((Bool )1);   11318     libhb_shutdown((Bool )1);
11316   } else {   11319   } else {
11317     11320  
11318   }   11321   }
11319   return;   11322   return;
11320 }   11323 }
11321 }   11324 }
11322 static void for_libhb__get_stacktrace(Thr *hbt , Addr *frames , UWord nRequest )   11325 static void for_libhb__get_stacktrace(Thr *hbt , Addr *frames , UWord nRequest )
11323 {   11326 {
11324   Thread *thr ;   11327   Thread *thr ;
11325   ThreadId tid ;   11328   ThreadId tid ;
11326   UWord nActual ;   11329   UWord nActual ;
11327   UInt tmp ;   11330   UInt tmp ;
11328     11331  
11329   {   11332   {
11330   if (hbt) {   11333   if (hbt) {
11331     11334  
11332   } else {   11335   } else {
11333     vgPlain_assert_fail((Bool )0, (Char const   *)"hbt",   11336     vgPlain_assert_fail((Bool )0, (Char const   *)"hbt",
11334                         (Char const   *)"hg_main.c", 4707,   11337                         (Char const   *)"hg_main.c", 4707,
11335                         (Char const   *)"for_libhb__get_stacktrace", "");   11338                         (Char const   *)"for_libhb__get_stacktrace", "");
11336   }   11339   }
11337   thr = libhb_get_Thr_hgthread(hbt);   11340   thr = libhb_get_Thr_hgthread(hbt);
11338   if (thr) {   11341   if (thr) {
11339     11342  
11340   } else {   11343   } else {
11341     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   11344     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
11342                         (Char const   *)"hg_main.c", 4709,   11345                         (Char const   *)"hg_main.c", 4709,
11343                         (Char const   *)"for_libhb__get_stacktrace", "");   11346                         (Char const   *)"for_libhb__get_stacktrace", "");
11344   }   11347   }
11345   tid = map_threads_maybe_reverse_lookup_SLOW(thr);   11348   tid = map_threads_maybe_reverse_lookup_SLOW(thr);
11346   tmp = vgPlain_get_StackTrace(tid, frames, (UInt )nRequest,   11349   tmp = vgPlain_get_StackTrace(tid, frames, (UInt )nRequest,
11347                                (StackTrace )((void *)0),   11350                                (StackTrace )((void *)0),
11348                                (StackTrace )((void *)0), (Word )0);   11351                                (StackTrace )((void *)0), (Word )0);
11349   nActual = (UWord )tmp;   11352   nActual = (UWord )tmp;
11350   if (nActual <= nRequest) {   11353   if (nActual <= nRequest) {
11351     11354  
11352   } else {   11355   } else {
11353     vgPlain_assert_fail((Bool )0, (Char const   *)"nActual <= nRequest",   11356     vgPlain_assert_fail((Bool )0, (Char const   *)"nActual <= nRequest",
11354                         (Char const   *)"hg_main.c", 4713,   11357                         (Char const   *)"hg_main.c", 4713,
11355                         (Char const   *)"for_libhb__get_stacktrace", "");   11358                         (Char const   *)"for_libhb__get_stacktrace", "");
11356   }   11359   }
11357   while (nActual < nRequest) {   11360   while (nActual < nRequest) {
11358     *(frames + nActual) = (Addr )0;   11361     *(frames + nActual) = (Addr )0;
11359     nActual ++;   11362     nActual ++;
11360   }   11363   }
11361   return;   11364   return;
11362 }   11365 }
11363 }   11366 }
11364 static ExeContext *for_libhb__get_EC(Thr *hbt )   11367 static ExeContext *for_libhb__get_EC(Thr *hbt )
11365 {   11368 {
11366   Thread *thr ;   11369   Thread *thr ;
11367   ThreadId tid ;   11370   ThreadId tid ;
11368   ExeContext *ec ;   11371   ExeContext *ec ;
11369     11372  
11370   {   11373   {
11371   if (hbt) {   11374   if (hbt) {
11372     11375  
11373   } else {   11376   } else {
11374     vgPlain_assert_fail((Bool )0, (Char const   *)"hbt",   11377     vgPlain_assert_fail((Bool )0, (Char const   *)"hbt",
11375                         (Char const   *)"hg_main.c", 4724,   11378                         (Char const   *)"hg_main.c", 4724,
11376                         (Char const   *)"for_libhb__get_EC", "");   11379                         (Char const   *)"for_libhb__get_EC", "");
11377   }   11380   }
11378   thr = libhb_get_Thr_hgthread(hbt);   11381   thr = libhb_get_Thr_hgthread(hbt);
11379   if (thr) {   11382   if (thr) {
11380     11383  
11381   } else {   11384   } else {
11382     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",   11385     vgPlain_assert_fail((Bool )0, (Char const   *)"thr",
11383                         (Char const   *)"hg_main.c", 4726,   11386                         (Char const   *)"hg_main.c", 4726,
11384                         (Char const   *)"for_libhb__get_EC", "");   11387                         (Char const   *)"for_libhb__get_EC", "");
11385   }   11388   }
11386   tid = map_threads_maybe_reverse_lookup_SLOW(thr);   11389   tid = map_threads_maybe_reverse_lookup_SLOW(thr);
11387   ec = vgPlain_record_ExeContext(tid, (Word )0);   11390   ec = vgPlain_record_ExeContext(tid, (Word )0);
11388   return (ec);   11391   return (ec);
11389 }   11392 }
11390 }   11393 }
11391 static void hg_post_clo_init(void)   11394 static void hg_post_clo_init(void)
11392 {   11395 {
11393   Thr *hbthr_root ;   11396   Thr *hbthr_root ;
11394     11397  
11395   {   11398   {
11396   hbthr_root = libhb_init(& for_libhb__get_stacktrace, & for_libhb__get_EC);   11399   hbthr_root = libhb_init(& for_libhb__get_stacktrace, & for_libhb__get_EC);
11397   if (vgHelgrind_clo_track_lockorders) {   11400   if (vgHelgrind_clo_track_lockorders) {
11398     laog__init();   11401     laog__init();
11399   } else {   11402   } else {
11400     11403  
11401   }   11404   }
11402   initialise_data_structures(hbthr_root);   11405   initialise_data_structures(hbthr_root);
11403   return;   11406   return;
11404 }   11407 }
11405 }   11408 }
11406 static void hg_pre_clo_init(void)   11409 static void hg_pre_clo_init(void)
11407 {   11410 {
11408     11411  
11409     11412  
11410   {   11413   {
11411   vgPlain_details_name((Char *)"Helgrind");   11414   vgPlain_details_name((Char *)"Helgrind");
11412   vgPlain_details_version((Char *)((void *)0));   11415   vgPlain_details_version((Char *)((void *)0));
11413   vgPlain_details_description((Char *)"a thread error detector");   11416   vgPlain_details_description((Char *)"a thread error detector");
11414   vgPlain_details_copyright_author((Char *)"Copyright (C) 2007-2010, and GNU GPL\'d, by OpenWorks LLP et al.");   11417   vgPlain_details_copyright_author((Char *)"Copyright (C) 2007-2010, and GNU GPL\'d, by OpenWorks LLP et al.");
11415   vgPlain_details_bug_reports_to((Char *)"www.valgrind.org");   11418   vgPlain_details_bug_reports_to((Char *)"www.valgrind.org");
11416   vgPlain_details_avg_translation_sizeB((UInt )320);   11419   vgPlain_details_avg_translation_sizeB((UInt )320);
11417   vgPlain_basic_tool_funcs(& hg_post_clo_init, & hg_instrument, & hg_fini);   11420   vgPlain_basic_tool_funcs(& hg_post_clo_init, & hg_instrument, & hg_fini);
11418   vgPlain_needs_core_errors();   11421   vgPlain_needs_core_errors();
11419   vgPlain_needs_tool_errors(& vgHelgrind_eq_Error, & vgHelgrind_before_pp_Error,   11422   vgPlain_needs_tool_errors(& vgHelgrind_eq_Error, & vgHelgrind_before_pp_Error,
11420                             & vgHelgrind_pp_Error, (Bool )0,   11423                             & vgHelgrind_pp_Error, (Bool )0,
11421                             & vgHelgrind_update_extra,   11424                             & vgHelgrind_update_extra,
11422                             & vgHelgrind_recognised_suppression,   11425                             & vgHelgrind_recognised_suppression,
11423                             & vgHelgrind_read_extra_suppression_info,   11426                             & vgHelgrind_read_extra_suppression_info,
11424                             & vgHelgrind_error_matches_suppression,   11427                             & vgHelgrind_error_matches_suppression,
11425                             & vgHelgrind_get_error_name,   11428                             & vgHelgrind_get_error_name,
11426                             & vgHelgrind_get_extra_suppression_info);   11429                             & vgHelgrind_get_extra_suppression_info);
11427   vgPlain_needs_xml_output();   11430   vgPlain_needs_xml_output();
11428   vgPlain_needs_command_line_options(& hg_process_cmd_line_option,   11431   vgPlain_needs_command_line_options(& hg_process_cmd_line_option,
11429                                      & hg_print_usage, & hg_print_debug_usage);   11432                                      & hg_print_usage, & hg_print_debug_usage);
11430   vgPlain_needs_client_requests(& hg_handle_client_request);   11433   vgPlain_needs_client_requests(& hg_handle_client_request);
11431   vgPlain_needs_malloc_replacement(& hg_cli__malloc, & hg_cli____builtin_new,   11434   vgPlain_needs_malloc_replacement(& hg_cli__malloc, & hg_cli____builtin_new,
11432                                    & hg_cli____builtin_vec_new,   11435                                    & hg_cli____builtin_vec_new,
11433                                    & hg_cli__memalign, & hg_cli__calloc,   11436                                    & hg_cli__memalign, & hg_cli__calloc,
11434                                    & hg_cli__free, & hg_cli____builtin_delete,   11437                                    & hg_cli__free, & hg_cli____builtin_delete,
11435                                    & hg_cli____builtin_vec_delete,   11438                                    & hg_cli____builtin_vec_delete,
11436                                    & hg_cli__realloc,   11439                                    & hg_cli__realloc,
11437                                    & hg_cli_malloc_usable_size, (SizeT )16);   11440                                    & hg_cli_malloc_usable_size, (SizeT )16);
11438   vgPlain_track_new_mem_startup(& evh__new_mem_w_perms);   11441   vgPlain_track_new_mem_startup(& evh__new_mem_w_perms);
11439   vgPlain_track_new_mem_stack_signal(& evh__new_mem_w_tid);   11442   vgPlain_track_new_mem_stack_signal(& evh__new_mem_w_tid);
11440   vgPlain_track_new_mem_brk(& evh__new_mem_w_tid);   11443   vgPlain_track_new_mem_brk(& evh__new_mem_w_tid);
11441   vgPlain_track_new_mem_mmap(& evh__new_mem_w_perms);   11444   vgPlain_track_new_mem_mmap(& evh__new_mem_w_perms);
11442   vgPlain_track_new_mem_stack(& evh__new_mem_stack);   11445   vgPlain_track_new_mem_stack(& evh__new_mem_stack);
11443   vgPlain_track_copy_mem_remap(& evh__copy_mem);   11446   vgPlain_track_copy_mem_remap(& evh__copy_mem);
11444   vgPlain_track_change_mem_mprotect(& evh__set_perms);   11447   vgPlain_track_change_mem_mprotect(& evh__set_perms);
11445   vgPlain_track_die_mem_stack_signal(& evh__die_mem);   11448   vgPlain_track_die_mem_stack_signal(& evh__die_mem);
11446   vgPlain_track_die_mem_brk(& evh__die_mem);   11449   vgPlain_track_die_mem_brk(& evh__die_mem);
11447   vgPlain_track_die_mem_munmap(& evh__die_mem);   11450   vgPlain_track_die_mem_munmap(& evh__die_mem);
11448   vgPlain_track_die_mem_stack(& evh__die_mem);   11451   vgPlain_track_die_mem_stack(& evh__die_mem);
11449   vgPlain_track_ban_mem_stack((void (*)(Addr a , SizeT len ))((void *)0));   11452   vgPlain_track_ban_mem_stack((void (*)(Addr a , SizeT len ))((void *)0));
11450   vgPlain_track_pre_mem_read(& evh__pre_mem_read);   11453   vgPlain_track_pre_mem_read(& evh__pre_mem_read);
11451   vgPlain_track_pre_mem_read_asciiz(& evh__pre_mem_read_asciiz);   11454   vgPlain_track_pre_mem_read_asciiz(& evh__pre_mem_read_asciiz);
11452   vgPlain_track_pre_mem_write(& evh__pre_mem_write);   11455   vgPlain_track_pre_mem_write(& evh__pre_mem_write);
11453   vgPlain_track_post_mem_write((void (*)(CorePart part , ThreadId tid , Addr a ,   11456   vgPlain_track_post_mem_write((void (*)(CorePart part , ThreadId tid , Addr a ,
11454                                          SizeT size ))((void *)0));   11457                                          SizeT size ))((void *)0));
11455   vgPlain_track_pre_thread_ll_create(& evh__pre_thread_ll_create);   11458   vgPlain_track_pre_thread_ll_create(& evh__pre_thread_ll_create);
11456   vgPlain_track_pre_thread_ll_exit(& evh__pre_thread_ll_exit);   11459   vgPlain_track_pre_thread_ll_exit(& evh__pre_thread_ll_exit);
11457   vgPlain_track_start_client_code(& evh__start_client_code);   11460   vgPlain_track_start_client_code(& evh__start_client_code);
11458   vgPlain_track_stop_client_code(& evh__stop_client_code);   11461   vgPlain_track_stop_client_code(& evh__stop_client_code);
11459   if (sizeof(void *) == sizeof(struct _MallocMeta *)) {   11462   if (sizeof(void *) == sizeof(struct _MallocMeta *)) {
11460     11463  
11461   } else {   11464   } else {
11462     vgPlain_assert_fail((Bool )0,   11465     vgPlain_assert_fail((Bool )0,
11463                         (Char const   *)"sizeof(void*) == sizeof(struct _MallocMeta*)",   11466                         (Char const   *)"sizeof(void*) == sizeof(struct _MallocMeta*)",
11464                         (Char const   *)"hg_main.c", 4840,   11467                         (Char const   *)"hg_main.c", 4840,
11465                         (Char const   *)"hg_pre_clo_init", "");   11468                         (Char const   *)"hg_pre_clo_init", "");
11466   }   11469   }
11467   if (sizeof(UWord ) == sizeof(Addr )) {   11470   if (sizeof(UWord ) == sizeof(Addr )) {
11468     11471  
11469   } else {   11472   } else {
11470     vgPlain_assert_fail((Bool )0,   11473     vgPlain_assert_fail((Bool )0,
11471                         (Char const   *)"sizeof(UWord) == sizeof(Addr)",   11474                         (Char const   *)"sizeof(UWord) == sizeof(Addr)",
11472                         (Char const   *)"hg_main.c", 4841,   11475                         (Char const   *)"hg_main.c", 4841,
11473                         (Char const   *)"hg_pre_clo_init", "");   11476                         (Char const   *)"hg_pre_clo_init", "");
11474   }   11477   }
11475   hg_mallocmeta_table = vgPlain_HT_construct((HChar *)"hg_malloc_metadata_table");   11478   hg_mallocmeta_table = vgPlain_HT_construct((HChar *)"hg_malloc_metadata_table");
11476   vgPlain_atfork((void (*)(ThreadId  ))((void *)0),   11479   vgPlain_atfork((void (*)(ThreadId  ))((void *)0),
11477                  (void (*)(ThreadId  ))((void *)0), & evh__atfork_child);   11480                  (void (*)(ThreadId  ))((void *)0), & evh__atfork_child);
11478   return;   11481   return;
11479 }   11482 }
11480 }   11483 }
11481 void (*vgPlain_tl_pre_clo_init)(void)  =    & hg_pre_clo_init;   11484 void (*vgPlain_tl_pre_clo_init)(void)  =    & hg_pre_clo_init;